From 74b7ef722e955e93aa9439c5a46373d406f10b55 Mon Sep 17 00:00:00 2001 From: petechd Date: Wed, 15 Jan 2025 15:49:12 +0000 Subject: [PATCH 01/12] Fix script --- .../test_checkbox_detail_answer_dropdown.json | 128 -- .../test_checkbox_detail_answer_multiple.json | 116 - .../test_checkbox_detail_answer_numeric.json | 96 - ...test_checkbox_detail_answer_textfield.json | 198 -- .../test/en/test_checkbox_instruction.json | 168 -- .../en/test_conditional_combined_routing.json | 147 -- schemas/test/en/test_confirmation_email.json | 75 - .../test/en/test_confirmation_question.json | 220 -- ...nfirmation_question_backwards_routing.json | 190 -- ...ion_question_within_repeating_section.json | 491 ----- schemas/test/en/test_currency.json | 190 -- schemas/test/en/test_custom_page_titles.json | 1096 --------- .../test/en/test_custom_question_summary.json | 153 -- schemas/test/en/test_date_range.json | 68 - .../en/test_date_validation_combined.json | 153 -- ...test_date_validation_mm_yyyy_combined.json | 153 -- .../test/en/test_date_validation_range.json | 84 - .../test/en/test_date_validation_single.json | 165 -- .../test_date_validation_yyyy_combined.json | 153 -- schemas/test/en/test_dates.json | 135 -- schemas/test/en/test_default.json | 79 - schemas/test/en/test_default_with_skip.json | 119 - schemas/test/en/test_dob_date.json | 213 -- schemas/test/en/test_dropdown_mandatory.json | 76 - ...pdown_mandatory_with_overridden_error.json | 80 - schemas/test/en/test_dropdown_optional.json | 76 - schemas/test/en/test_durations.json | 97 - ...ynamic_answer_options_function_driven.json | 346 --- ...s_function_driven_with_static_options.json | 370 ---- ..._driven_with_static_options_mandatory.json | 370 ---- .../en/test_dynamic_answers_list_source.json | 588 ----- ...t_dynamic_radio_options_from_checkbox.json | 134 -- schemas/test/en/test_feedback.json | 74 - .../en/test_feedback_email_confirmation.json | 74 - .../en/test_grand_calculated_summary.json | 294 --- ...ed_summary_cross_section_dependencies.json | 368 ---- ...ated_summary_inside_repeating_section.json | 1109 ---------- ...alculated_summary_overlapping_answers.json | 357 --- ..._calculated_summary_repeating_answers.json | 1426 ------------ schemas/test/en/test_hub_and_spoke.json | 319 --- .../en/test_hub_and_spoke_custom_content.json | 118 - .../test/en/test_hub_complete_sections.json | 198 -- ...test_hub_section_required_and_enabled.json | 122 -- ...test_hub_section_required_with_repeat.json | 431 ---- ...on_required_with_repeat_supplementary.json | 414 ---- schemas/test/en/test_individual_response.json | 626 ------ ...t_individual_response_on_hub_disabled.json | 448 ---- schemas/test/en/test_instructions.json | 81 - .../test/en/test_interstitial_definition.json | 170 -- schemas/test/en/test_interstitial_page.json | 96 - .../test/en/test_interstitial_page_title.json | 64 - schemas/test/en/test_interviewer_note.json | 115 - schemas/test/en/test_introduction.json | 720 ------ schemas/test/en/test_introduction_hub.json | 636 ------ schemas/test/en/test_language.json | 246 --- .../test_last_viewed_question_guidance.json | 976 --------- ...est_last_viewed_question_guidance_hub.json | 235 -- .../test_list_change_evaluates_sections.json | 352 --- schemas/test/en/test_list_collector.json | 344 --- .../en/test_list_collector_content_page.json | 550 ----- .../test_list_collector_driving_checkbox.json | 699 ------ .../test_list_collector_driving_question.json | 251 --- .../en/test_list_collector_list_summary.json | 528 ----- ...y_and_collector_with_driving_question.json | 304 --- .../test_list_collector_primary_person.json | 341 --- ...ctor_repeating_blocks_section_summary.json | 432 ---- ...t_collector_repeating_blocks_with_hub.json | 826 ------- .../test_list_collector_same_name_items.json | 394 ---- .../test_list_collector_section_summary.json | 549 ----- ...st_list_collector_two_list_collectors.json | 436 ---- .../test/en/test_list_collector_variants.json | 385 ---- ...ist_collector_variants_primary_person.json | 368 ---- ...st_collector_variants_section_summary.json | 551 ----- .../en/test_list_summary_on_question.json | 401 ---- schemas/test/en/test_markup.json | 74 - schemas/test/en/test_metadata_routing.json | 117 - schemas/test/en/test_mobile_number.json | 61 - schemas/test/en/test_multiple_answers.json | 217 -- schemas/test/en/test_multiple_piping.json | 244 --- schemas/test/en/test_mutually_exclusive.json | 573 ----- .../en/test_mutually_exclusive_multiple.json | 622 ------ .../test/en/test_new_calculated_summary.json | 571 ----- ...ed_summary_cross_section_dependencies.json | 375 ---- ..._cross_section_dependencies_repeating.json | 603 ----- ...alculated_summary_dependent_questions.json | 176 -- ..._summary_repeating_and_static_answers.json | 727 ------ ...ulated_summary_repeating_answers_only.json | 322 --- ...w_calculated_summary_repeating_blocks.json | 521 ----- ..._calculated_summary_repeating_section.json | 820 ------- schemas/test/en/test_numbers.json | 547 ----- ...est_optional_guidance_and_description.json | 219 -- schemas/test/en/test_percentage.json | 91 - ...aceholder_based_on_first_item_in_list.json | 386 ---- .../en/test_placeholder_default_value.json | 169 -- ...pendencies_with_calculation_summaries.json | 647 ------ .../test_placeholder_difference_in_years.json | 127 -- ...holder_difference_in_years_month_year.json | 127 -- ..._difference_in_years_month_year_range.json | 134 -- ...placeholder_difference_in_years_range.json | 134 -- ...test_placeholder_first_non_empty_item.json | 275 --- ...empty_item_cross_section_dependencies.json | 283 --- ...rst_non_empty_item_repeating_sections.json | 528 ----- schemas/test/en/test_placeholder_full.json | 341 --- .../test/en/test_placeholder_metadata.json | 85 - ...t_placeholder_option_label_from_value.json | 151 -- .../en/test_placeholder_playback_list.json | 164 -- .../test/en/test_placeholder_transform.json | 336 --- ...aceholder_transform_date_range_bounds.json | 174 -- schemas/test/en/test_plural_forms.json | 135 -- ...block_value_source_repeating_sections.json | 392 ---- ...ction_value_source_repeating_sections.json | 392 ---- .../en/test_progress_value_source_blocks.json | 210 -- ...ess_value_source_blocks_cross_section.json | 224 -- ...gress_value_source_calculated_summary.json | 517 ----- ...ue_source_calculated_summary_extended.json | 1129 ---------- ...peating_sections_chained_dependencies.json | 490 ----- ...ress_value_source_section_enabled_hub.json | 110 - ...ue_source_section_enabled_hub_complex.json | 251 --- ...s_value_source_section_enabled_no_hub.json | 114 - schemas/test/en/test_question_definition.json | 78 - .../test_question_definition_array_type.json | 80 - .../test/en/test_question_description.json | 69 - schemas/test/en/test_question_guidance.json | 310 --- .../test/en/test_question_title_in_error.json | 160 -- .../en/test_radio_checkbox_descriptions.json | 126 -- .../en/test_radio_detail_answer_dropdown.json | 128 -- .../en/test_radio_detail_answer_multiple.json | 92 - .../en/test_radio_detail_answer_numeric.json | 95 - .../en/test_radio_detail_answer_visible.json | 147 -- schemas/test/en/test_radio_mandatory.json | 74 - ...andatory_with_detail_answer_mandatory.json | 77 - ...nswer_mandatory_with_overridden_error.json | 82 - ...mandatory_with_detail_answer_optional.json | 77 - ...radio_mandatory_with_overridden_error.json | 75 - schemas/test/en/test_radio_optional.json | 70 - ...optional_with_detail_answer_mandatory.json | 77 - ...nswer_mandatory_with_overridden_error.json | 82 - ..._optional_with_detail_answer_optional.json | 77 - schemas/test/en/test_radio_voluntary.json | 98 - ...dio_voluntary_with_repeating_sections.json | 245 --- schemas/test/en/test_relationships.json | 934 -------- .../test/en/test_relationships_primary.json | 1364 ------------ .../test/en/test_relationships_unrelated.json | 855 -------- .../en/test_repeating_section_summaries.json | 411 ---- ...repeating_sections_with_hub_and_spoke.json | 1312 ----------- schemas/test/en/test_routing_and.json | 180 -- ...ing_and_skipping_section_dependencies.json | 707 ------ ...ction_dependencies_calculated_summary.json | 338 --- ...n_dependencies_new_calculated_summary.json | 360 --- .../en/test_routing_answer_comparison.json | 124 -- .../en/test_routing_answered_unanswered.json | 242 -- ...t_routing_case_insensitive_text_field.json | 125 -- .../en/test_routing_checkbox_contains.json | 131 -- .../test_routing_checkbox_contains_all.json | 137 -- .../test_routing_checkbox_contains_any.json | 137 -- .../en/test_routing_checkbox_contains_in.json | 137 -- .../test/en/test_routing_checkbox_count.json | 169 -- schemas/test/en/test_routing_date_equals.json | 311 --- .../en/test_routing_date_greater_than.json | 168 -- ...t_routing_date_greater_than_or_equals.json | 149 -- .../test/en/test_routing_date_less_than.json | 108 - ...test_routing_date_less_than_or_equals.json | 108 - .../test/en/test_routing_date_not_equals.json | 108 - schemas/test/en/test_routing_group.json | 137 -- schemas/test/en/test_routing_not.json | 124 -- ...g_not_affected_by_answers_not_on_path.json | 197 -- .../test/en/test_routing_number_equals.json | 129 -- .../en/test_routing_number_greater_than.json | 129 -- ..._routing_number_greater_than_or_equal.json | 129 -- ...reater_than_or_equal_single_condition.json | 129 -- .../en/test_routing_number_less_than.json | 129 -- ...est_routing_number_less_than_or_equal.json | 129 -- ...r_less_than_or_equal_single_condition.json | 129 -- .../en/test_routing_number_not_equals.json | 129 -- .../en/test_routing_on_multiple_select.json | 126 -- schemas/test/en/test_routing_or.json | 180 -- ...o_questionnaire_end_multiple_sections.json | 152 -- ...g_to_questionnaire_end_single_section.json | 135 -- .../test/en/test_routing_to_section_end.json | 204 -- .../en/test_section_enabled_checkbox.json | 168 -- schemas/test/en/test_section_enabled_hub.json | 163 -- .../test/en/test_section_enabled_radio.json | 115 - schemas/test/en/test_section_summary.json | 284 --- ...st_show_section_summary_on_completion.json | 201 -- ...test_skip_condition_answer_comparison.json | 157 -- .../test/en/test_skip_condition_block.json | 100 - .../test/en/test_skip_condition_group.json | 106 - schemas/test/en/test_skip_condition_list.json | 272 --- .../test/en/test_skip_condition_not_set.json | 110 - schemas/test/en/test_skip_condition_set.json | 110 - ...st_submit_with_custom_submission_text.json | 72 - schemas/test/en/test_submit_with_summary.json | 191 -- ...t_with_summary_custom_submission_text.json | 69 - ..._submit_with_summary_return_to_answer.json | 233 -- schemas/test/en/test_supplementary_data.json | 1950 ----------------- schemas/test/en/test_textarea.json | 73 - schemas/test/en/test_textfield.json | 67 - .../test/en/test_textfield_suggestions.json | 86 - schemas/test/en/test_thank_you.json | 83 - schemas/test/en/test_theme_dbt.json | 75 - schemas/test/en/test_theme_dbt_dsit.json | 75 - schemas/test/en/test_theme_dbt_dsit_ni.json | 75 - schemas/test/en/test_theme_dbt_ni.json | 75 - schemas/test/en/test_theme_desnz.json | 75 - schemas/test/en/test_theme_desnz_ni.json | 75 - schemas/test/en/test_theme_health.json | 70 - .../test/en/test_theme_northernireland.json | 75 - schemas/test/en/test_theme_ons_nhs.json | 75 - schemas/test/en/test_theme_orr.json | 75 - schemas/test/en/test_theme_social.json | 71 - schemas/test/en/test_theme_ukhsa_ons.json | 75 - schemas/test/en/test_timeout.json | 63 - schemas/test/en/test_timeout_modal.json | 58 - schemas/test/en/test_title.json | 70 - .../en/test_titles_radio_and_checkbox.json | 353 --- schemas/test/en/test_unit_patterns.json | 277 --- ...ion_sum_against_total_dynamic_answers.json | 470 ---- ...st_validation_sum_against_total_equal.json | 111 - ..._sum_against_total_equal_or_less_than.json | 110 - ...inst_total_hub_with_dependent_section.json | 252 --- ...alidation_sum_against_total_less_than.json | 115 - ...validation_sum_against_total_multiple.json | 120 - ...otal_repeating_with_dependent_section.json | 506 ----- ...t_validation_sum_against_value_source.json | 190 -- schemas/test/en/test_variants_content.json | 106 - .../en/test_variants_first_item_in_list.json | 298 --- scripts/validate_test_schemas.sh | 4 +- 227 files changed, 2 insertions(+), 60883 deletions(-) delete mode 100644 schemas/test/en/test_checkbox_detail_answer_dropdown.json delete mode 100644 schemas/test/en/test_checkbox_detail_answer_multiple.json delete mode 100644 schemas/test/en/test_checkbox_detail_answer_numeric.json delete mode 100644 schemas/test/en/test_checkbox_detail_answer_textfield.json delete mode 100644 schemas/test/en/test_checkbox_instruction.json delete mode 100644 schemas/test/en/test_conditional_combined_routing.json delete mode 100644 schemas/test/en/test_confirmation_email.json delete mode 100644 schemas/test/en/test_confirmation_question.json delete mode 100644 schemas/test/en/test_confirmation_question_backwards_routing.json delete mode 100644 schemas/test/en/test_confirmation_question_within_repeating_section.json delete mode 100644 schemas/test/en/test_currency.json delete mode 100644 schemas/test/en/test_custom_page_titles.json delete mode 100644 schemas/test/en/test_custom_question_summary.json delete mode 100644 schemas/test/en/test_date_range.json delete mode 100644 schemas/test/en/test_date_validation_combined.json delete mode 100644 schemas/test/en/test_date_validation_mm_yyyy_combined.json delete mode 100644 schemas/test/en/test_date_validation_range.json delete mode 100644 schemas/test/en/test_date_validation_single.json delete mode 100644 schemas/test/en/test_date_validation_yyyy_combined.json delete mode 100644 schemas/test/en/test_dates.json delete mode 100644 schemas/test/en/test_default.json delete mode 100644 schemas/test/en/test_default_with_skip.json delete mode 100644 schemas/test/en/test_dob_date.json delete mode 100644 schemas/test/en/test_dropdown_mandatory.json delete mode 100644 schemas/test/en/test_dropdown_mandatory_with_overridden_error.json delete mode 100644 schemas/test/en/test_dropdown_optional.json delete mode 100644 schemas/test/en/test_durations.json delete mode 100644 schemas/test/en/test_dynamic_answer_options_function_driven.json delete mode 100644 schemas/test/en/test_dynamic_answer_options_function_driven_with_static_options.json delete mode 100644 schemas/test/en/test_dynamic_answer_options_function_driven_with_static_options_mandatory.json delete mode 100644 schemas/test/en/test_dynamic_answers_list_source.json delete mode 100644 schemas/test/en/test_dynamic_radio_options_from_checkbox.json delete mode 100644 schemas/test/en/test_feedback.json delete mode 100644 schemas/test/en/test_feedback_email_confirmation.json delete mode 100644 schemas/test/en/test_grand_calculated_summary.json delete mode 100644 schemas/test/en/test_grand_calculated_summary_cross_section_dependencies.json delete mode 100644 schemas/test/en/test_grand_calculated_summary_inside_repeating_section.json delete mode 100644 schemas/test/en/test_grand_calculated_summary_overlapping_answers.json delete mode 100644 schemas/test/en/test_grand_calculated_summary_repeating_answers.json delete mode 100644 schemas/test/en/test_hub_and_spoke.json delete mode 100644 schemas/test/en/test_hub_and_spoke_custom_content.json delete mode 100644 schemas/test/en/test_hub_complete_sections.json delete mode 100644 schemas/test/en/test_hub_section_required_and_enabled.json delete mode 100644 schemas/test/en/test_hub_section_required_with_repeat.json delete mode 100644 schemas/test/en/test_hub_section_required_with_repeat_supplementary.json delete mode 100644 schemas/test/en/test_individual_response.json delete mode 100644 schemas/test/en/test_individual_response_on_hub_disabled.json delete mode 100644 schemas/test/en/test_instructions.json delete mode 100644 schemas/test/en/test_interstitial_definition.json delete mode 100644 schemas/test/en/test_interstitial_page.json delete mode 100644 schemas/test/en/test_interstitial_page_title.json delete mode 100644 schemas/test/en/test_interviewer_note.json delete mode 100644 schemas/test/en/test_introduction.json delete mode 100644 schemas/test/en/test_introduction_hub.json delete mode 100644 schemas/test/en/test_language.json delete mode 100644 schemas/test/en/test_last_viewed_question_guidance.json delete mode 100644 schemas/test/en/test_last_viewed_question_guidance_hub.json delete mode 100644 schemas/test/en/test_list_change_evaluates_sections.json delete mode 100644 schemas/test/en/test_list_collector.json delete mode 100644 schemas/test/en/test_list_collector_content_page.json delete mode 100644 schemas/test/en/test_list_collector_driving_checkbox.json delete mode 100644 schemas/test/en/test_list_collector_driving_question.json delete mode 100644 schemas/test/en/test_list_collector_list_summary.json delete mode 100644 schemas/test/en/test_list_collector_primary_and_collector_with_driving_question.json delete mode 100644 schemas/test/en/test_list_collector_primary_person.json delete mode 100644 schemas/test/en/test_list_collector_repeating_blocks_section_summary.json delete mode 100644 schemas/test/en/test_list_collector_repeating_blocks_with_hub.json delete mode 100644 schemas/test/en/test_list_collector_same_name_items.json delete mode 100644 schemas/test/en/test_list_collector_section_summary.json delete mode 100644 schemas/test/en/test_list_collector_two_list_collectors.json delete mode 100644 schemas/test/en/test_list_collector_variants.json delete mode 100644 schemas/test/en/test_list_collector_variants_primary_person.json delete mode 100644 schemas/test/en/test_list_collector_variants_section_summary.json delete mode 100644 schemas/test/en/test_list_summary_on_question.json delete mode 100644 schemas/test/en/test_markup.json delete mode 100644 schemas/test/en/test_metadata_routing.json delete mode 100644 schemas/test/en/test_mobile_number.json delete mode 100644 schemas/test/en/test_multiple_answers.json delete mode 100644 schemas/test/en/test_multiple_piping.json delete mode 100644 schemas/test/en/test_mutually_exclusive.json delete mode 100644 schemas/test/en/test_mutually_exclusive_multiple.json delete mode 100644 schemas/test/en/test_new_calculated_summary.json delete mode 100644 schemas/test/en/test_new_calculated_summary_cross_section_dependencies.json delete mode 100644 schemas/test/en/test_new_calculated_summary_cross_section_dependencies_repeating.json delete mode 100644 schemas/test/en/test_new_calculated_summary_dependent_questions.json delete mode 100644 schemas/test/en/test_new_calculated_summary_repeating_and_static_answers.json delete mode 100644 schemas/test/en/test_new_calculated_summary_repeating_answers_only.json delete mode 100644 schemas/test/en/test_new_calculated_summary_repeating_blocks.json delete mode 100644 schemas/test/en/test_new_calculated_summary_repeating_section.json delete mode 100644 schemas/test/en/test_numbers.json delete mode 100644 schemas/test/en/test_optional_guidance_and_description.json delete mode 100644 schemas/test/en/test_percentage.json delete mode 100644 schemas/test/en/test_placeholder_based_on_first_item_in_list.json delete mode 100644 schemas/test/en/test_placeholder_default_value.json delete mode 100644 schemas/test/en/test_placeholder_dependencies_with_calculation_summaries.json delete mode 100644 schemas/test/en/test_placeholder_difference_in_years.json delete mode 100644 schemas/test/en/test_placeholder_difference_in_years_month_year.json delete mode 100644 schemas/test/en/test_placeholder_difference_in_years_month_year_range.json delete mode 100644 schemas/test/en/test_placeholder_difference_in_years_range.json delete mode 100644 schemas/test/en/test_placeholder_first_non_empty_item.json delete mode 100644 schemas/test/en/test_placeholder_first_non_empty_item_cross_section_dependencies.json delete mode 100644 schemas/test/en/test_placeholder_first_non_empty_item_repeating_sections.json delete mode 100644 schemas/test/en/test_placeholder_full.json delete mode 100644 schemas/test/en/test_placeholder_metadata.json delete mode 100644 schemas/test/en/test_placeholder_option_label_from_value.json delete mode 100644 schemas/test/en/test_placeholder_playback_list.json delete mode 100644 schemas/test/en/test_placeholder_transform.json delete mode 100644 schemas/test/en/test_placeholder_transform_date_range_bounds.json delete mode 100644 schemas/test/en/test_plural_forms.json delete mode 100644 schemas/test/en/test_progress_block_value_source_repeating_sections.json delete mode 100644 schemas/test/en/test_progress_section_value_source_repeating_sections.json delete mode 100644 schemas/test/en/test_progress_value_source_blocks.json delete mode 100644 schemas/test/en/test_progress_value_source_blocks_cross_section.json delete mode 100644 schemas/test/en/test_progress_value_source_calculated_summary.json delete mode 100644 schemas/test/en/test_progress_value_source_calculated_summary_extended.json delete mode 100644 schemas/test/en/test_progress_value_source_repeating_sections_chained_dependencies.json delete mode 100644 schemas/test/en/test_progress_value_source_section_enabled_hub.json delete mode 100644 schemas/test/en/test_progress_value_source_section_enabled_hub_complex.json delete mode 100644 schemas/test/en/test_progress_value_source_section_enabled_no_hub.json delete mode 100644 schemas/test/en/test_question_definition.json delete mode 100644 schemas/test/en/test_question_definition_array_type.json delete mode 100644 schemas/test/en/test_question_description.json delete mode 100644 schemas/test/en/test_question_guidance.json delete mode 100644 schemas/test/en/test_question_title_in_error.json delete mode 100644 schemas/test/en/test_radio_checkbox_descriptions.json delete mode 100644 schemas/test/en/test_radio_detail_answer_dropdown.json delete mode 100644 schemas/test/en/test_radio_detail_answer_multiple.json delete mode 100644 schemas/test/en/test_radio_detail_answer_numeric.json delete mode 100644 schemas/test/en/test_radio_detail_answer_visible.json delete mode 100644 schemas/test/en/test_radio_mandatory.json delete mode 100644 schemas/test/en/test_radio_mandatory_with_detail_answer_mandatory.json delete mode 100644 schemas/test/en/test_radio_mandatory_with_detail_answer_mandatory_with_overridden_error.json delete mode 100644 schemas/test/en/test_radio_mandatory_with_detail_answer_optional.json delete mode 100644 schemas/test/en/test_radio_mandatory_with_overridden_error.json delete mode 100644 schemas/test/en/test_radio_optional.json delete mode 100644 schemas/test/en/test_radio_optional_with_detail_answer_mandatory.json delete mode 100644 schemas/test/en/test_radio_optional_with_detail_answer_mandatory_with_overridden_error.json delete mode 100644 schemas/test/en/test_radio_optional_with_detail_answer_optional.json delete mode 100644 schemas/test/en/test_radio_voluntary.json delete mode 100644 schemas/test/en/test_radio_voluntary_with_repeating_sections.json delete mode 100644 schemas/test/en/test_relationships.json delete mode 100644 schemas/test/en/test_relationships_primary.json delete mode 100644 schemas/test/en/test_relationships_unrelated.json delete mode 100644 schemas/test/en/test_repeating_section_summaries.json delete mode 100644 schemas/test/en/test_repeating_sections_with_hub_and_spoke.json delete mode 100644 schemas/test/en/test_routing_and.json delete mode 100644 schemas/test/en/test_routing_and_skipping_section_dependencies.json delete mode 100644 schemas/test/en/test_routing_and_skipping_section_dependencies_calculated_summary.json delete mode 100644 schemas/test/en/test_routing_and_skipping_section_dependencies_new_calculated_summary.json delete mode 100644 schemas/test/en/test_routing_answer_comparison.json delete mode 100644 schemas/test/en/test_routing_answered_unanswered.json delete mode 100644 schemas/test/en/test_routing_case_insensitive_text_field.json delete mode 100644 schemas/test/en/test_routing_checkbox_contains.json delete mode 100644 schemas/test/en/test_routing_checkbox_contains_all.json delete mode 100644 schemas/test/en/test_routing_checkbox_contains_any.json delete mode 100644 schemas/test/en/test_routing_checkbox_contains_in.json delete mode 100644 schemas/test/en/test_routing_checkbox_count.json delete mode 100644 schemas/test/en/test_routing_date_equals.json delete mode 100644 schemas/test/en/test_routing_date_greater_than.json delete mode 100644 schemas/test/en/test_routing_date_greater_than_or_equals.json delete mode 100644 schemas/test/en/test_routing_date_less_than.json delete mode 100644 schemas/test/en/test_routing_date_less_than_or_equals.json delete mode 100644 schemas/test/en/test_routing_date_not_equals.json delete mode 100644 schemas/test/en/test_routing_group.json delete mode 100644 schemas/test/en/test_routing_not.json delete mode 100644 schemas/test/en/test_routing_not_affected_by_answers_not_on_path.json delete mode 100644 schemas/test/en/test_routing_number_equals.json delete mode 100644 schemas/test/en/test_routing_number_greater_than.json delete mode 100644 schemas/test/en/test_routing_number_greater_than_or_equal.json delete mode 100644 schemas/test/en/test_routing_number_greater_than_or_equal_single_condition.json delete mode 100644 schemas/test/en/test_routing_number_less_than.json delete mode 100644 schemas/test/en/test_routing_number_less_than_or_equal.json delete mode 100644 schemas/test/en/test_routing_number_less_than_or_equal_single_condition.json delete mode 100644 schemas/test/en/test_routing_number_not_equals.json delete mode 100644 schemas/test/en/test_routing_on_multiple_select.json delete mode 100644 schemas/test/en/test_routing_or.json delete mode 100644 schemas/test/en/test_routing_to_questionnaire_end_multiple_sections.json delete mode 100644 schemas/test/en/test_routing_to_questionnaire_end_single_section.json delete mode 100644 schemas/test/en/test_routing_to_section_end.json delete mode 100644 schemas/test/en/test_section_enabled_checkbox.json delete mode 100644 schemas/test/en/test_section_enabled_hub.json delete mode 100644 schemas/test/en/test_section_enabled_radio.json delete mode 100644 schemas/test/en/test_section_summary.json delete mode 100644 schemas/test/en/test_show_section_summary_on_completion.json delete mode 100644 schemas/test/en/test_skip_condition_answer_comparison.json delete mode 100644 schemas/test/en/test_skip_condition_block.json delete mode 100644 schemas/test/en/test_skip_condition_group.json delete mode 100644 schemas/test/en/test_skip_condition_list.json delete mode 100644 schemas/test/en/test_skip_condition_not_set.json delete mode 100644 schemas/test/en/test_skip_condition_set.json delete mode 100644 schemas/test/en/test_submit_with_custom_submission_text.json delete mode 100644 schemas/test/en/test_submit_with_summary.json delete mode 100644 schemas/test/en/test_submit_with_summary_custom_submission_text.json delete mode 100644 schemas/test/en/test_submit_with_summary_return_to_answer.json delete mode 100644 schemas/test/en/test_supplementary_data.json delete mode 100644 schemas/test/en/test_textarea.json delete mode 100644 schemas/test/en/test_textfield.json delete mode 100644 schemas/test/en/test_textfield_suggestions.json delete mode 100644 schemas/test/en/test_thank_you.json delete mode 100644 schemas/test/en/test_theme_dbt.json delete mode 100644 schemas/test/en/test_theme_dbt_dsit.json delete mode 100644 schemas/test/en/test_theme_dbt_dsit_ni.json delete mode 100644 schemas/test/en/test_theme_dbt_ni.json delete mode 100644 schemas/test/en/test_theme_desnz.json delete mode 100644 schemas/test/en/test_theme_desnz_ni.json delete mode 100644 schemas/test/en/test_theme_health.json delete mode 100644 schemas/test/en/test_theme_northernireland.json delete mode 100644 schemas/test/en/test_theme_ons_nhs.json delete mode 100644 schemas/test/en/test_theme_orr.json delete mode 100644 schemas/test/en/test_theme_social.json delete mode 100644 schemas/test/en/test_theme_ukhsa_ons.json delete mode 100644 schemas/test/en/test_timeout.json delete mode 100644 schemas/test/en/test_timeout_modal.json delete mode 100644 schemas/test/en/test_title.json delete mode 100644 schemas/test/en/test_titles_radio_and_checkbox.json delete mode 100644 schemas/test/en/test_unit_patterns.json delete mode 100644 schemas/test/en/test_validation_sum_against_total_dynamic_answers.json delete mode 100644 schemas/test/en/test_validation_sum_against_total_equal.json delete mode 100644 schemas/test/en/test_validation_sum_against_total_equal_or_less_than.json delete mode 100644 schemas/test/en/test_validation_sum_against_total_hub_with_dependent_section.json delete mode 100644 schemas/test/en/test_validation_sum_against_total_less_than.json delete mode 100644 schemas/test/en/test_validation_sum_against_total_multiple.json delete mode 100644 schemas/test/en/test_validation_sum_against_total_repeating_with_dependent_section.json delete mode 100644 schemas/test/en/test_validation_sum_against_value_source.json delete mode 100644 schemas/test/en/test_variants_content.json delete mode 100644 schemas/test/en/test_variants_first_item_in_list.json diff --git a/schemas/test/en/test_checkbox_detail_answer_dropdown.json b/schemas/test/en/test_checkbox_detail_answer_dropdown.json deleted file mode 100644 index 01bdacb84c..0000000000 --- a/schemas/test/en/test_checkbox_detail_answer_dropdown.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Checkbox with Dropdown Detail Answer", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "checkbox", - "title": "Dropdown Checkbox with detail answer", - "blocks": [ - { - "type": "Question", - "id": "optional-checkbox-with-dropdown-detail-answer-block", - "question": { - "type": "General", - "id": "optional-checkbox-with-dropdown-detail-answer-question", - "title": "What is your favourite Ice Cream topping?", - "guidance": { - "contents": [ - { - "list": ["Fruit detail answer is optional", "Jam detail answer is mandatory"] - } - ] - }, - "answers": [ - { - "type": "Checkbox", - "id": "optional-checkbox-with-dropdown-detail-answer", - "instruction": "Select your favourite toppings", - "mandatory": false, - "options": [ - { - "label": "Sprinkles", - "value": "Sprinkles" - }, - { - "label": "Fruit", - "value": "Fruit", - "detail_answer": { - "type": "Dropdown", - "id": "optional-checkbox-with-optional-dropdown-detail-answer", - "mandatory": false, - "label": "Please specify type", - "placeholder": "Select fruit", - "options": [ - { - "label": "Mango", - "value": "Mango" - }, - { - "label": "Pineapple", - "value": "Pineapple" - }, - { - "label": "Peach", - "value": "Peach" - } - ] - } - }, - { - "label": "Jam", - "value": "Jam", - "detail_answer": { - "type": "Dropdown", - "id": "optional-checkbox-with-mandatory-dropdown-detail-answer", - "mandatory": true, - "label": "Please specify type", - "validation": { - "messages": { - "MANDATORY_DROPDOWN": "Please select the type of Jam" - } - }, - "options": [ - { - "label": "Strawberry", - "value": "Strawberry" - }, - { - "label": "Raspberry", - "value": "Raspberry" - }, - { - "label": "Apricot", - "value": "Apricot" - } - ] - } - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_checkbox_detail_answer_multiple.json b/schemas/test/en/test_checkbox_detail_answer_multiple.json deleted file mode 100644 index 99d965bc8b..0000000000 --- a/schemas/test/en/test_checkbox_detail_answer_multiple.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Detail answer fields", - "theme": "default", - "description": "A questionnaire to demo checkbox field detail answer input.", - "messages": { - "NUMBER_TOO_LARGE": "Number is too large", - "NUMBER_TOO_SMALL": "Number cannot be less than zero", - "INVALID_NUMBER": "Please enter an integer" - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "mandatory-checkbox", - "question": { - "answers": [ - { - "id": "mandatory-checkbox-answer", - "mandatory": false, - "options": [ - { - "label": "None", - "value": "None" - }, - { - "label": "Cheese", - "value": "Cheese", - "detail_answer": { - "mandatory": false, - "id": "cheese-type-answer", - "label": "Type specific cheese if cheddar isn’t wanted", - "type": "TextField" - } - }, - { - "label": "Ham", - "value": "Ham" - }, - { - "label": "Pineapple", - "value": "Pineapple" - }, - { - "label": "Tuna", - "value": "Tuna" - }, - { - "label": "Pepperoni", - "value": "Pepperoni" - }, - { - "label": "Your choice", - "description": "Choose any other topping", - "value": "Your choice", - "detail_answer": { - "mandatory": true, - "id": "your-choice-answer-mandatory", - "label": "Please specify your topping", - "type": "TextField", - "validation": { - "messages": { - "MANDATORY_TEXTFIELD": "Enter your topping choice to continue" - } - } - } - } - ], - "type": "Checkbox", - "validation": { - "messages": {} - } - } - ], - "id": "mandatory-checkbox-question", - "title": "Which pizza toppings would you like?", - "type": "General" - } - } - ], - "id": "checkboxes" - } - ] - } - ] -} diff --git a/schemas/test/en/test_checkbox_detail_answer_numeric.json b/schemas/test/en/test_checkbox_detail_answer_numeric.json deleted file mode 100644 index 1796bcf13f..0000000000 --- a/schemas/test/en/test_checkbox_detail_answer_numeric.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Other input fields", - "theme": "default", - "description": "A questionnaire to demo checkbox field detail answer input.", - "messages": { - "NUMBER_TOO_LARGE": "Number is too large", - "NUMBER_TOO_SMALL": "Number cannot be less than zero", - "INVALID_NUMBER": "Please enter an integer" - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "checkbox-numeric-detail", - "question": { - "answers": [ - { - "id": "checkbox-numeric-detail-answer", - "mandatory": true, - "options": [ - { - "label": "None", - "value": "None" - }, - { - "label": "1", - "value": "1" - }, - { - "label": "2", - "value": "2" - }, - { - "label": "Other", - "description": "Choose any number of toppings", - "value": "Other", - "detail_answer": { - "mandatory": false, - "id": "other-answer", - "label": "Please specify other", - "type": "Number", - "maximum": { - "value": 20 - } - } - } - ], - "type": "Checkbox", - "validation": { - "messages": {} - } - } - ], - "id": "checkbox-question-numeric-detail", - "title": "How many pizza toppings would you like?", - "type": "General" - } - } - ], - "id": "checkboxes" - } - ] - } - ] -} diff --git a/schemas/test/en/test_checkbox_detail_answer_textfield.json b/schemas/test/en/test_checkbox_detail_answer_textfield.json deleted file mode 100644 index 64f604939e..0000000000 --- a/schemas/test/en/test_checkbox_detail_answer_textfield.json +++ /dev/null @@ -1,198 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Checkbox details answer visibility", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section-1", - "groups": [ - { - "id": "checkbox", - "title": "Checkbox Open", - "blocks": [ - { - "type": "Question", - "id": "checkbox-visible-true", - "question": { - "type": "General", - "id": "checkbox-visible-true-question", - "title": "What is your favourite drink?", - "answers": [ - { - "type": "Checkbox", - "id": "checkbox-visible-true-answer", - "mandatory": false, - "options": [ - { - "label": "Coffee", - "value": "Coffee" - }, - { - "detail_answer": { - "id": "checkbox-visible-true-answer-other", - "label": "Enter your favourite drink", - "mandatory": false, - "visible": true, - "type": "TextField" - }, - "label": "Other", - "value": "Other" - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "checkbox-visible-false", - "question": { - "type": "General", - "id": "checkbox-visible-false-question", - "title": "What is your favourite food?", - "answers": [ - { - "type": "Checkbox", - "id": "checkbox-visible-false-answer", - "mandatory": false, - "options": [ - { - "label": "Ice cream", - "value": "Ice cream" - }, - { - "description": "Select to enter answer", - "detail_answer": { - "id": "checkbox-visible-false-answer-other", - "label": "Enter your favourite food", - "mandatory": false, - "visible": false, - "type": "TextField" - }, - "label": "Other", - "value": "Other" - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "checkbox-visible-none", - "question": { - "type": "General", - "id": "checkbox-visible-none-question", - "title": "What is your favourite colour?", - "answers": [ - { - "type": "Checkbox", - "id": "checkbox-visible-none-answer", - "mandatory": false, - "options": [ - { - "label": "Blue", - "value": "Blue" - }, - { - "description": "Select to enter answer", - "detail_answer": { - "id": "checkbox-visible-none-answer-other", - "label": "Enter your favourite colour", - "mandatory": false, - "type": "TextField" - }, - "label": "Other", - "value": "Other" - } - ] - } - ] - } - }, - { - "id": "mutually-exclusive", - "question": { - "answers": [ - { - "id": "mutually-exclusive-answer", - "mandatory": false, - "options": [ - { - "label": "Football", - "value": "Football" - }, - { - "label": "Rugby", - "value": "Rugby" - }, - { - "label": "Cricket", - "value": "Cricket" - }, - { - "detail_answer": { - "id": "mutually-exclusive-answer-other", - "label": "Please specify your favourite sport", - "mandatory": false, - "max_length": 100, - "type": "TextField", - "visible": true - }, - "label": "Other", - "value": "Other" - } - ], - "type": "Checkbox" - }, - { - "id": "mutually-exclusive-answer-exclusive", - "mandatory": false, - "options": [ - { - "label": "None", - "value": "None" - } - ], - "type": "Checkbox" - } - ], - "id": "mutually-exclusive-question", - "mandatory": false, - "title": "What is your favourite sport?", - "type": "MutuallyExclusive" - }, - "type": "Question" - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_checkbox_instruction.json b/schemas/test/en/test_checkbox_instruction.json deleted file mode 100644 index 715ce4d12b..0000000000 --- a/schemas/test/en/test_checkbox_instruction.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test checkbox answer instruction", - "theme": "default", - "description": "A questionnaire to test checkbox answer instruction.", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "default-instruction-checkbox", - "question": { - "answers": [ - { - "id": "default-instruction-checkbox-answer", - "mandatory": false, - "options": [ - { - "label": "Red", - "value": "Red" - }, - { - "label": "Blue", - "value": "Blue" - }, - { - "label": "Green", - "value": "Green" - } - ], - "type": "Checkbox" - } - ], - "id": "default-instruction-checkbox-question", - "title": "What is your favourite colour?", - "type": "General" - } - }, - { - "type": "Question", - "id": "no-instruction-checkbox", - "question": { - "answers": [ - { - "id": "no-instruction-checkbox-answer", - "mandatory": false, - "instruction": null, - "options": [ - { - "label": "Rugby", - "value": "Rugby" - }, - { - "label": "Golf", - "value": "Golf" - }, - { - "label": "Tennis", - "value": "Tennis" - } - ], - "type": "Checkbox" - } - ], - "id": "no-instruction-checkbox-question", - "title": "What is your favourite sport?", - "type": "General" - } - }, - { - "type": "Question", - "id": "custom-instruction-checkbox", - "question": { - "answers": [ - { - "id": "custom-instruction-checkbox-answer", - "mandatory": false, - "instruction": "Select your answer", - "options": [ - { - "label": "Monday", - "value": "Monday" - }, - { - "label": "Saturday", - "value": "Saturday" - }, - { - "label": "Sunday", - "value": "Sunday" - } - ], - "type": "Checkbox" - } - ], - "id": "custom-instruction-checkbox-question", - "title": "What is your favorite day of the week?", - "type": "General" - } - }, - { - "type": "Question", - "id": "instruction-and-label-checkbox", - "question": { - "answers": [ - { - "id": "instruction-and-label-checkbox-answer", - "mandatory": false, - "instruction": "Select your answer", - "label": "Days of the Week", - "options": [ - { - "label": "Monday", - "value": "Monday" - }, - { - "label": "Saturday", - "value": "Saturday" - }, - { - "label": "Sunday", - "value": "Sunday" - } - ], - "type": "Checkbox" - } - ], - "id": "instruction-and-label-question", - "title": "What is your favorite day of the week?", - "type": "General" - } - } - ], - "id": "checkboxes" - } - ] - } - ] -} diff --git a/schemas/test/en/test_conditional_combined_routing.json b/schemas/test/en/test_conditional_combined_routing.json deleted file mode 100644 index a8a2935baa..0000000000 --- a/schemas/test/en/test_conditional_combined_routing.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "023", - "title": "Test Conditional Routing", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "single-answer-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "conditional-routing-block", - "question": { - "id": "conditional-routing-question", - "title": "Do you drink coffee?", - "type": "General", - "answers": [ - { - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "Sometimes", - "value": "Sometimes" - }, - { - "label": "No, I prefer tea", - "value": "No, I prefer tea" - }, - { - "label": "I don’t like coffee", - "value": "I don’t like coffee" - }, - { - "label": "No, I don’t drink any hot drinks", - "value": "No, I don’t drink any hot drinks" - } - ], - "id": "conditional-routing-answer", - "label": "Which conditional question should we jump to?", - "mandatory": true, - "type": "Radio" - } - ] - }, - "routing_rules": [ - { - "block": "response-any", - "when": { - "in": [ - { - "identifier": "conditional-routing-answer", - "source": "answers" - }, - ["Yes", "Sometimes"] - ] - } - }, - { - "block": "response-not-any", - "when": { - "not": [ - { - "in": [ - { "identifier": "conditional-routing-answer", "source": "answers" }, - ["Yes", "Sometimes", "I don’t like coffee", "No, I don’t drink any hot drinks"] - ] - } - ] - } - }, - { - "section": "End" - } - ] - }, - { - "type": "Question", - "id": "response-any", - "question": { - "id": "response-any-question", - "title": "How many cups of coffee do you drink a day?", - "type": "General", - "answers": [ - { - "id": "response-any-number-of-cups", - "label": "Number of cups", - "mandatory": true, - "type": "Number" - } - ] - } - }, - { - "type": "Question", - "id": "response-not-any", - "question": { - "id": "response-not-any-question", - "title": "How many cups of tea do you drink a day?", - "type": "General", - "answers": [ - { - "id": "response-not-any-number-of-cups", - "label": "Number of cups", - "mandatory": true, - "type": "Number" - } - ] - } - } - ], - "id": "conditional-routing-within-group", - "title": "Conditional routing within group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_confirmation_email.json b/schemas/test/en/test_confirmation_email.json deleted file mode 100644 index 835b153691..0000000000 --- a/schemas/test/en/test_confirmation_email.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "form_type": "H", - "region_code": "GB-WLS", - "title": "Confirmation email test schema", - "theme": "default", - "description": "A questionnaire to test confirmation email", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "post_submission": { - "confirmation_email": true - }, - "sections": [ - { - "id": "schema-confirmation-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "schema-confirmation", - "question": { - "answers": [ - { - "type": "Radio", - "id": "schema-confirmation-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ], - "id": "schema-question", - "title": "Are you aware you can send a confirmation email for this schema?", - "type": "General" - } - } - ], - "id": "schema-confirmation-group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_confirmation_question.json b/schemas/test/en/test_confirmation_question.json deleted file mode 100644 index 1f526d4182..0000000000 --- a/schemas/test/en/test_confirmation_question.json +++ /dev/null @@ -1,220 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "survey_id": "139", - "theme": "default", - "title": "Confirmation Question Test", - "data_version": "0.0.3", - "description": "Confirmation Question Test", - "navigation": { - "visible": true - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "trad_as", - "type": "string", - "optional": true - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "title": "Questions", - "groups": [ - { - "id": "confirmation-block", - "title": "Confirmation Question Test", - "blocks": [ - { - "id": "number-of-employees-total-block", - "question": { - "answers": [ - { - "id": "number-of-employees-total", - "label": "Total number of employees", - "mandatory": false, - "type": "Number", - "default": 0 - } - ], - "id": "number-of-employees-total-question", - "title": { - "text": "How many employees work at {company_name}?", - "placeholders": [ - { - "placeholder": "company_name", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "metadata", - "identifier": "trad_as" - }, - { - "source": "metadata", - "identifier": "ru_name" - } - ] - } - } - ] - } - ] - }, - "type": "General" - }, - "type": "Question" - }, - { - "type": "ConfirmationQuestion", - "id": "confirm-zero-employees-block", - "skip_conditions": { - "when": { - ">": [ - { - "source": "answers", - "identifier": "number-of-employees-total" - }, - 0 - ] - } - }, - "question": { - "type": "General", - "answers": [ - { - "type": "Radio", - "id": "confirm-zero-employees-answer", - "options": [ - { - "label": "Yes this is correct", - "value": "Yes this is correct" - }, - { - "label": "No I need to correct this", - "value": "No I need to correct this" - } - ], - "mandatory": true - } - ], - "id": "confirm-zero-employees-question", - "title": { - "text": "The current number of employees for {company_name} is 0, is this correct?", - "placeholders": [ - { - "placeholder": "company_name", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "metadata", - "identifier": "trad_as" - }, - { - "source": "metadata", - "identifier": "ru_name" - } - ] - } - } - ] - } - ] - } - }, - "routing_rules": [ - { - "when": { - "==": [ - { - "identifier": "confirm-zero-employees-answer", - "source": "answers" - }, - "No I need to correct this" - ] - }, - "block": "number-of-employees-total-block" - }, - { - "section": "End" - } - ] - }, - { - "id": "number-of-employees-split-block", - "type": "Question", - "question": { - "answers": [ - { - "id": "number-of-employees-male-more-30-hours", - "label": "Number of male employees working more than 30 hours per week", - "mandatory": false, - "type": "Number", - "maximum": { - "value": { - "source": "answers", - "identifier": "number-of-employees-total" - } - } - }, - { - "id": "number-of-employees-female-more-30-hours", - "label": "Number of female employees working more than 30 hours per week", - "mandatory": false, - "type": "Number", - "maximum": { - "value": { - "source": "answers", - "identifier": "number-of-employees-total" - } - } - } - ], - "id": "number-of-employees-split-question", - "title": { - "text": "Of the {number_of_employees_total} total employees employed, how many male and female employees worked the following hours?", - "placeholders": [ - { - "placeholder": "number_of_employees_total", - "value": { - "source": "answers", - "identifier": "number-of-employees-total" - } - } - ] - }, - "type": "General" - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_confirmation_question_backwards_routing.json b/schemas/test/en/test_confirmation_question_backwards_routing.json deleted file mode 100644 index b8bc14b8fe..0000000000 --- a/schemas/test/en/test_confirmation_question_backwards_routing.json +++ /dev/null @@ -1,190 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "survey_id": "139", - "theme": "default", - "title": "New Confirmation Question Test", - "data_version": "0.0.3", - "description": "New Confirmation Question Test", - "navigation": { - "visible": true - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "trad_as", - "type": "string", - "optional": true - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "title": "Section 1", - "groups": [ - { - "id": "confirmation", - "title": "Confirmation Driver", - "blocks": [ - { - "type": "Question", - "id": "route-backwards-block", - "question": { - "type": "General", - "id": "route-backwards-question", - "title": "Do you want the confirmation question to route backwards, so the answer can be changed?", - "answers": [ - { - "type": "Radio", - "id": "route-backwards-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "section-2", - "title": "Section 2", - "groups": [ - { - "id": "group-2", - "title": "Confirmation Question", - "blocks": [ - { - "id": "number-of-employees-total-block", - "question": { - "answers": [ - { - "id": "number-of-employees-total", - "label": "Total number of employees", - "mandatory": false, - "type": "Number", - "default": 0 - } - ], - "id": "number-of-employees-total-question", - "title": { - "text": "How many employees work at {company_name}?", - "placeholders": [ - { - "placeholder": "company_name", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "metadata", - "identifier": "trad_as" - }, - { - "source": "metadata", - "identifier": "ru_name" - } - ] - } - } - ] - } - ] - }, - "type": "General" - }, - "type": "Question" - }, - { - "type": "ConfirmationQuestion", - "id": "confirm-zero-employees-block", - "question": { - "type": "General", - "answers": [ - { - "type": "Radio", - "id": "confirm-zero-employees-answer", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No I need to correct this", - "value": "No I need to correct this" - } - ], - "mandatory": true - } - ], - "id": "confirm-zero-employees-question", - "title": "Did you answer the last question correctly?" - }, - "routing_rules": [ - { - "block": "number-of-employees-total-block", - "when": { - "and": [ - { - "==": [ - { - "source": "answers", - "identifier": "confirm-zero-employees-answer" - }, - "No I need to correct this" - ] - }, - { - "==": [ - { - "source": "answers", - "identifier": "route-backwards-answer" - }, - "Yes" - ] - } - ] - } - }, - { - "section": "End" - } - ] - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_confirmation_question_within_repeating_section.json b/schemas/test/en/test_confirmation_question_within_repeating_section.json deleted file mode 100644 index 6f754192de..0000000000 --- a/schemas/test/en/test_confirmation_question_within_repeating_section.json +++ /dev/null @@ -1,491 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "survey_id": "139", - "theme": "default", - "title": "Confirmation Question Test", - "data_version": "0.0.3", - "description": "Confirmation Question Test", - "navigation": { - "visible": true - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "trad_as", - "type": "string", - "optional": true - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "default-section", - "title": "Questions", - "summary": { - "show_on_completion": true - }, - "repeat": { - "for_list": "people", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "groups": [ - { - "id": "dob-group", - "title": "Date of birth", - "blocks": [ - { - "type": "Question", - "id": "dob-block", - "question": { - "answers": [ - { - "id": "date-of-birth-answer", - "mandatory": true, - "maximum": { - "value": "now" - }, - "minimum": { - "offset_by": { - "years": -115 - }, - "value": "2019-10-13" - }, - "type": "Date" - } - ], - "guidance": { - "contents": [ - { - "description": "For example 31 12 1970" - } - ] - }, - "id": "date-of-birth-question", - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "What is {person_name_possessive} date of birth?" - }, - "type": "General" - } - }, - { - "type": "ConfirmationQuestion", - "id": "confirm-dob-block", - "skip_conditions": { - "when": { - "<=": [ - { - "date": [ - { - "source": "answers", - "identifier": "date-of-birth-answer" - } - ] - }, - { "date": ["now", { "years": -16 }] } - ] - } - }, - "question": { - "answers": [ - { - "id": "confirm-date-of-birth-answer", - "mandatory": true, - "options": [ - { - "label": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - }, - { - "placeholder": "age", - "transforms": [ - { - "arguments": { - "first_date": { - "identifier": "date-of-birth-answer", - "source": "answers" - }, - "second_date": { - "value": "now" - } - }, - "transform": "calculate_date_difference" - } - ] - } - ], - "text": "Yes, {person_name} is {age} old" - }, - "value": "Yes, {person_name} is {age} old" - }, - { - "label": "No, I need to change their date of birth", - "value": "No, I need to change their date of birth" - } - ], - "type": "Radio" - } - ], - "id": "confirm-date-of-birth", - "title": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - }, - { - "placeholder": "age", - "transforms": [ - { - "arguments": { - "first_date": { - "identifier": "date-of-birth-answer", - "source": "answers" - }, - "second_date": { - "value": "now" - } - }, - "transform": "calculate_date_difference" - } - ] - } - ], - "text": "{person_name} is {age} old. Is this correct?" - }, - "type": "General" - }, - "routing_rules": [ - { - "block": "dob-block", - "when": { - "==": [ - { - "source": "answers", - "identifier": "confirm-date-of-birth-answer" - }, - "No, I need to change their date of birth" - ] - } - }, - { - "section": "End" - } - ] - }, - { - "id": "carer-block", - "question": { - "id": "carer-question", - "type": "General", - "title": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ], - "text": "Does {person_name} look after, or give any help or support to, anyone because they have long-term physical or mental health conditions or illnesses, or problems related to old age?" - }, - "answers": [ - { - "id": "carer-answer", - "label": "Carer", - "mandatory": false, - "type": "Radio", - "default": "Yes", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "type": "Question" - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_currency.json b/schemas/test/en/test_currency.json deleted file mode 100644 index 9f26654f51..0000000000 --- a/schemas/test/en/test_currency.json +++ /dev/null @@ -1,190 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Other input fields", - "theme": "default", - "description": "A questionnaire to test currency input type", - "messages": { - "INVALID_DECIMAL": "Please enter a number to %(max)d decimal places" - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string", - "optional": true - }, - { - "name": "trad_as", - "type": "string", - "optional": true - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "block", - "question": { - "answers": [ - { - "id": "answer-gbp", - "label": "How much did you spend?", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "maximum": { - "value": 10000 - } - }, - { - "id": "answer-usd", - "label": "How much did you spend?", - "mandatory": false, - "type": "Currency", - "currency": "USD", - "decimal_places": 2, - "maximum": { - "value": 10000 - } - }, - { - "id": "answer-eur", - "label": "How much did you spend?", - "mandatory": false, - "type": "Currency", - "currency": "EUR", - "decimal_places": 2, - "maximum": { - "value": 10000 - } - }, - { - "id": "answer-jpy", - "label": "How much did you spend?", - "mandatory": false, - "type": "Currency", - "currency": "JPY", - "maximum": { - "value": 1000000 - } - }, - { - "id": "answer-gbp-max-range", - "label": "How much did you spend? (Max range)", - "mandatory": false, - "type": "Currency", - "currency": "GBP" - } - ], - "id": "currency-question", - "title": "Currency Input Test Positve", - "type": "General" - } - }, - { - "type": "Question", - "id": "negative-block", - "question": { - "answers": [ - { - "id": "negative-answer-gbp", - "label": "How much did you spend?", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "maximum": { - "value": 10000 - }, - "minimum": { - "value": -1000000 - } - }, - { - "id": "negative-answer-usd", - "label": "How much did you spend?", - "mandatory": false, - "type": "Currency", - "currency": "USD", - "decimal_places": 2, - "maximum": { - "value": 10000 - }, - "minimum": { - "value": -1000000 - } - }, - { - "id": "negative-answer-eur", - "label": "How much did you spend?", - "mandatory": false, - "type": "Currency", - "currency": "EUR", - "decimal_places": 2, - "maximum": { - "value": 10000 - }, - "minimum": { - "value": -1000000 - } - }, - { - "id": "negative-answer-jpy", - "label": "How much did you spend?", - "mandatory": false, - "type": "Currency", - "currency": "JPY", - "maximum": { - "value": 1000000 - }, - "minimum": { - "value": -1000000 - } - }, - { - "id": "answer-gbp-min-range", - "label": "How much did you spend? (Min range)", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "minimum": { - "value": -99999999999999 - } - } - ], - "id": "negative-currency-question", - "title": "Currency Input Test Including Negative Values", - "type": "General" - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_custom_page_titles.json b/schemas/test/en/test_custom_page_titles.json deleted file mode 100644 index 1b9865a4a4..0000000000 --- a/schemas/test/en/test_custom_page_titles.json +++ /dev/null @@ -1,1096 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Custom Page Titles", - "theme": "default", - "description": "A questionnaire to test custom page titles.", - "messages": {}, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section", - "title": "Household", - "summary": { - "show_on_completion": true, - "page_title": "Custom section summary page title", - "items": [ - { - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders", - "for_list": "household", - "title": "Household members", - "type": "List" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "Relationships", - "blocks": [ - { - "id": "list-collector", - "type": "ListCollector", - "page_title": "Custom page title", - "for_list": "household", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live at 1 Pleasant Lane?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "page_title": "Add person {list_item_position}", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "page_title": "Edit person {list_item_position}", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "page_title": "Remove person {list_item_position}", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "People who live here", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "type": "RelationshipCollector", - "id": "relationships", - "title": "This will iterate over the household list, capturing the one way relationships.", - "page_title": "How Person {list_item_position} is related to Person {to_list_item_position}", - "for_list": "household", - "question": { - "id": "relationship-question", - "type": "General", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their ", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "answers": [ - { - "id": "relationship-answer", - "mandatory": true, - "type": "Relationship", - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} ", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "options": [ - { - "label": "Husband or Wife", - "value": "Husband or Wife", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their husband or wife", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} husband or wife", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - { - "label": "Legally registered civil partner", - "value": "Legally registered civil partner", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their legally registered civil partner", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} legally registered civil partner", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - { - "label": "Son or daughter", - "value": "Son or daughter", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their son or daughter", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} son or daughter", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - { - "label": "Brother or sister", - "value": "Brother or sister", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their brother or sister", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} brother or sister", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "description": "Including half brother or half sister" - } - ] - } - ] - }, - "skip_conditions": { - "when": { - "<": [ - { - "source": "list", - "identifier": "household", - "selector": "count" - }, - 2 - ] - } - } - } - ] - } - ] - }, - { - "title": "Individual Section", - "summary": { - "show_on_completion": true, - "page_title": "Summary" - }, - "groups": [ - { - "blocks": [ - { - "content": { - "contents": [ - { - "description": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ], - "text": "In this section, we are going to ask you questions about {person_name}." - } - }, - { - "list": ["date of birth"], - "title": "You will need to know personal details such as" - } - ], - "title": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ], - "text": "{person_name}" - } - }, - "page_title": "Individual interstitial", - "id": "individual-interstitial", - "type": "Interstitial" - }, - { - "id": "proxy", - "page_title": "Proxy question", - "question": { - "answers": [ - { - "default": "No, I am answering on their behalf", - "id": "proxy-answer", - "mandatory": false, - "options": [ - { - "label": "Yes, I am", - "value": "Yes, I am" - }, - { - "label": "No, I am answering on their behalf", - "value": "No, I am answering on their behalf" - } - ], - "type": "Radio" - } - ], - "id": "proxy-question", - "title": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ], - "text": "Are you {person_name}?" - }, - "type": "General" - }, - "type": "Question" - }, - { - "type": "Question", - "id": "date-of-birth", - "question": { - "id": "date-pipe-question", - "title": "What is your date of birth?", - "type": "General", - "answers": [ - { - "id": "date-dob", - "label": "For example 20 March 1990", - "mandatory": false, - "type": "Date" - } - ] - } - } - ], - "id": "personal-details-group", - "title": "Personal Details" - } - ], - "id": "individual-section", - "repeat": { - "for_list": "household", - "title": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ], - "text": "{person_name}" - }, - "page_title": "Person {list_item_position}" - } - } - ] -} diff --git a/schemas/test/en/test_custom_question_summary.json b/schemas/test/en/test_custom_question_summary.json deleted file mode 100644 index e89de05eab..0000000000 --- a/schemas/test/en/test_custom_question_summary.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Custom question summary", - "theme": "default", - "description": "A questionnaire to demo custom question summaries", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "title": "test", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "name", - "question": { - "id": "name-question", - "title": "Name", - "type": "General", - "summary": { - "concatenation_type": "Space" - }, - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": false, - "type": "TextField" - }, - { - "id": "middle-name", - "label": "Middle name", - "mandatory": false, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": false, - "type": "TextField" - } - ] - } - }, - { - "type": "Question", - "id": "address", - "question": { - "id": "address-question", - "title": "Address details", - "type": "General", - "summary": { - "concatenation_type": "Newline" - }, - "answers": [ - { - "id": "address-line1", - "label": "Address Line 1", - "mandatory": false, - "type": "TextField" - }, - { - "id": "address-line2", - "label": "Address Line 2", - "mandatory": false, - "type": "TextField" - }, - { - "id": "town-city", - "label": "Town/City", - "mandatory": false, - "type": "TextField" - }, - { - "id": "county", - "label": "County", - "mandatory": false, - "type": "TextField" - }, - { - "id": "postcode", - "label": "Postcode", - "mandatory": false, - "type": "TextField" - } - ] - } - }, - { - "type": "Question", - "id": "age", - "question": { - "id": "age-question", - "title": "Age", - "type": "General", - "summary": { - "concatenation_type": "Newline" - }, - "answers": [ - { - "id": "age-number", - "label": "Enter your age", - "mandatory": false, - "type": "Number" - }, - { - "id": "single-checkbox-answer", - "mandatory": false, - "instruction": "Confirmation", - "options": [ - { - "label": "This age is an estimate", - "value": "This age is an estimate" - } - ], - "type": "Checkbox" - } - ] - } - } - ], - "id": "default-group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_date_range.json b/schemas/test/en/test_date_range.json deleted file mode 100644 index ccfe1d9214..0000000000 --- a/schemas/test/en/test_date_range.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "023", - "title": "Date range", - "description": "A test schema for different date formats", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "date-block", - "question": { - "answers": [ - { - "id": "date-range-from-answer", - "label": "Period from", - "mandatory": true, - "type": "Date" - }, - { - "id": "date-range-to-answer", - "label": "Period to", - "mandatory": true, - "type": "Date" - } - ], - "id": "date-range-question", - "title": "Date range", - "warning": "The period to date must be after the period from date", - "type": "DateRange" - } - } - ], - "id": "dates" - } - ] - } - ] -} diff --git a/schemas/test/en/test_date_validation_combined.json b/schemas/test/en/test_date_validation_combined.json deleted file mode 100644 index 09d6ed7eb6..0000000000 --- a/schemas/test/en/test_date_validation_combined.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "023", - "title": "Date formats", - "description": "A test schema for different date formats", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "ref_p_start_date", - "type": "date" - }, - { - "name": "ref_p_end_date", - "type": "date" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "dates", - "title": "Date Range Validation", - "blocks": [ - { - "type": "Question", - "id": "date-range-block", - "question": { - "id": "date-range-question", - "title": "Enter Date Range", - "type": "DateRange", - "guidance": { - "contents": [ - { - "description": "Dates between 10 and 50 days apart" - }, - { - "description": { - "text": "Period from date greater than 19 days before {date}", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - } - }, - { - "description": { - "text": "Period to date no greater than 20 days after {date}", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_end_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - } - } - ] - }, - "period_limits": { - "minimum": { - "days": 10 - }, - "maximum": { - "days": 50 - } - }, - "answers": [ - { - "id": "date-range-from", - "label": "Period from", - "mandatory": true, - "type": "Date", - "minimum": { - "value": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "offset_by": { - "days": -19 - } - } - }, - { - "id": "date-range-to", - "label": "Period to", - "mandatory": true, - "type": "Date", - "maximum": { - "value": { - "source": "metadata", - "identifier": "ref_p_end_date" - }, - "offset_by": { - "days": 20 - } - } - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_date_validation_mm_yyyy_combined.json b/schemas/test/en/test_date_validation_mm_yyyy_combined.json deleted file mode 100644 index 4360d30ffa..0000000000 --- a/schemas/test/en/test_date_validation_mm_yyyy_combined.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "023", - "title": "Date formats", - "description": "A test schema for different date formats", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "ref_p_start_date", - "type": "date" - }, - { - "name": "ref_p_end_date", - "type": "date" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "dates", - "title": "Date Range Validation", - "blocks": [ - { - "type": "Question", - "id": "date-range-block", - "question": { - "id": "date-range-question", - "title": "Enter Date Range", - "type": "DateRange", - "guidance": { - "contents": [ - { - "description": "Dates between 2 and 3 months apart" - }, - { - "description": { - "text": "Period from date greater than 1 month before {date}", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - } - }, - { - "description": { - "text": "Period to date no greater than 3 months after {date}", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_end_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - } - } - ] - }, - "period_limits": { - "minimum": { - "months": 2 - }, - "maximum": { - "months": 3 - } - }, - "answers": [ - { - "id": "date-range-from", - "label": "Period from", - "mandatory": true, - "type": "MonthYearDate", - "minimum": { - "value": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "offset_by": { - "months": -1 - } - } - }, - { - "id": "date-range-to", - "label": "Period to", - "mandatory": true, - "type": "MonthYearDate", - "maximum": { - "value": { - "source": "metadata", - "identifier": "ref_p_end_date" - }, - "offset_by": { - "months": 3 - } - } - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_date_validation_range.json b/schemas/test/en/test_date_validation_range.json deleted file mode 100644 index 97658510fe..0000000000 --- a/schemas/test/en/test_date_validation_range.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "023", - "title": "Date formats", - "description": "A test schema for different date formats", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "dates", - "title": "Date Range Validation", - "blocks": [ - { - "type": "Question", - "id": "date-range-block", - "question": { - "id": "date-range-question", - "title": "Enter Date Range", - "type": "DateRange", - "guidance": { - "contents": [ - { - "description": "Enter a date range between 23 days and 1 month and 20 days apart" - } - ] - }, - "period_limits": { - "minimum": { - "days": 23 - }, - "maximum": { - "months": 1, - "days": 20 - } - }, - "answers": [ - { - "id": "date-range-from", - "label": "Period from", - "mandatory": true, - "type": "Date" - }, - { - "id": "date-range-to", - "label": "Period to", - "mandatory": true, - "type": "Date" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_date_validation_single.json b/schemas/test/en/test_date_validation_single.json deleted file mode 100644 index eeeabeb5a5..0000000000 --- a/schemas/test/en/test_date_validation_single.json +++ /dev/null @@ -1,165 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "023", - "title": "Date formats", - "description": "A test schema for single date period validation", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "ref_p_start_date", - "type": "date" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "dates", - "title": "Date Range Validation", - "blocks": [ - { - "type": "Question", - "id": "date-block", - "question": { - "id": "date-question", - "title": "Enter Date", - "type": "General", - "answers": [ - { - "id": "date", - "label": "Enter date", - "mandatory": true, - "type": "Date" - } - ] - } - }, - { - "type": "Question", - "id": "date-range-block", - "question": { - "id": "date-range-question", - "title": "Enter Date Range", - "type": "DateRange", - "guidance": { - "contents": [ - { - "description": { - "text": "Period ‘from’ date should be greater than 19 days before {date}", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - } - }, - { - "description": "Period ‘from’ should also be no greater than 20 days after 11 June 2017" - }, - { - "description": { - "text": "Period ‘to’ date should be greater than 1 month 10 days after {date}", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "answers", - "identifier": "date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - } - } - ] - }, - "answers": [ - { - "id": "date-range-from", - "label": "Period from", - "mandatory": true, - "type": "Date", - "minimum": { - "value": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "offset_by": { - "days": -19 - } - }, - "maximum": { - "value": "2017-06-11", - "offset_by": { - "days": 20 - } - } - }, - { - "id": "date-range-to", - "label": "Period to", - "mandatory": true, - "type": "Date", - "minimum": { - "value": { - "source": "answers", - "identifier": "date" - }, - "offset_by": { - "months": 1, - "days": 10 - } - } - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_date_validation_yyyy_combined.json b/schemas/test/en/test_date_validation_yyyy_combined.json deleted file mode 100644 index a0387efa52..0000000000 --- a/schemas/test/en/test_date_validation_yyyy_combined.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "023", - "title": "Date formats", - "description": "A test schema for different date formats", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "ref_p_start_date", - "type": "date" - }, - { - "name": "ref_p_end_date", - "type": "date" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "dates", - "title": "Date Range Validation", - "blocks": [ - { - "type": "Question", - "id": "date-range-block", - "question": { - "id": "date-range-question", - "title": "Enter Date Range", - "type": "DateRange", - "guidance": { - "contents": [ - { - "description": "Dates between 2 and 3 years apart" - }, - { - "description": { - "text": "Period from date greater than 1 year before {date}", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - } - }, - { - "description": { - "text": "Period to date no greater than 3 years after {date}", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_end_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - } - } - ] - }, - "period_limits": { - "minimum": { - "years": 2 - }, - "maximum": { - "years": 3 - } - }, - "answers": [ - { - "id": "date-range-from", - "label": "Period from", - "mandatory": true, - "type": "YearDate", - "minimum": { - "value": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "offset_by": { - "years": -1 - } - } - }, - { - "id": "date-range-to", - "label": "Period to", - "mandatory": true, - "type": "YearDate", - "maximum": { - "value": { - "source": "metadata", - "identifier": "ref_p_end_date" - }, - "offset_by": { - "years": 3 - } - } - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_dates.json b/schemas/test/en/test_dates.json deleted file mode 100644 index 90eadcffdf..0000000000 --- a/schemas/test/en/test_dates.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "023", - "title": "Date formats", - "description": "A test schema for different date formats", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "title": "Date Examples", - "groups": [ - { - "id": "dates", - "blocks": [ - { - "type": "Question", - "id": "date-range-block", - "question": { - "answers": [ - { - "id": "date-range-from-answer", - "label": "Period from", - "mandatory": true, - "type": "Date" - }, - { - "id": "date-range-to-answer", - "label": "Period to", - "mandatory": true, - "type": "Date" - } - ], - "id": "date-range-question", - "title": "Date range", - "type": "DateRange" - } - }, - { - "type": "Question", - "id": "date-month-year-block", - "question": { - "answers": [ - { - "id": "month-year-answer", - "mandatory": true, - "type": "MonthYearDate" - } - ], - "id": "month-year-question", - "title": "Date with month and year", - "type": "General" - } - }, - { - "type": "Question", - "id": "date-single-block", - "question": { - "answers": [ - { - "id": "single-date-answer", - "label": "Date", - "mandatory": true, - "type": "Date" - } - ], - "id": "single-date-question", - "title": "Single date type", - "type": "General" - } - }, - { - "type": "Question", - "id": "date-non-mandatory-block", - "question": { - "answers": [ - { - "id": "non-mandatory-date-answer", - "label": "Date", - "mandatory": false, - "type": "Date" - } - ], - "id": "non-mandatory-date-question", - "title": "Non Mandatory", - "type": "General" - } - }, - { - "type": "Question", - "id": "date-year-date-block", - "question": { - "answers": [ - { - "id": "year-date-answer", - "label": "Date", - "mandatory": false, - "type": "YearDate" - } - ], - "id": "year-date-question", - "title": "Year (YYYY)", - "type": "General" - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_default.json b/schemas/test/en/test_default.json deleted file mode 100644 index f7798f9ef1..0000000000 --- a/schemas/test/en/test_default.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Number Equals", - "theme": "default", - "description": "A test survey for routing based on an number equals", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "number-question-one", - "question": { - "answers": [ - { - "id": "answer-one", - "mandatory": false, - "type": "Number", - "label": "Leave blank", - "default": 0 - } - ], - "id": "question", - "title": "Don’t enter an answer. A default value will be used", - "type": "General" - } - }, - { - "type": "Question", - "id": "number-question-two", - "question": { - "answers": [ - { - "id": "answer-two", - "mandatory": false, - "type": "Number", - "label": "Enter a Value" - } - ], - "id": "question2", - "title": "Enter an answer. It will be shown on the summary page", - "type": "General" - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_default_with_skip.json b/schemas/test/en/test_default_with_skip.json deleted file mode 100644 index 08963ca5bf..0000000000 --- a/schemas/test/en/test_default_with_skip.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Number Equals", - "theme": "default", - "description": "A test survey for routing based on an number equals", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "number-question-one", - "question": { - "answers": [ - { - "id": "answer-one", - "mandatory": false, - "type": "Number", - "label": "Leave blank", - "default": 0 - } - ], - "id": "question", - "title": "Question One", - "type": "General" - } - }, - { - "type": "Question", - "id": "number-question-two", - "question": { - "answers": [ - { - "id": "answer-two", - "mandatory": false, - "type": "Number", - "label": "Enter a Value", - "default": 1 - } - ], - "id": "question2", - "title": "Question Two", - "type": "General" - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "answers", - "identifier": "answer-one" - }, - 1 - ] - } - } - }, - { - "type": "Question", - "id": "number-question-three", - "question": { - "answers": [ - { - "id": "answer-three", - "mandatory": false, - "type": "Number", - "label": "Leave blank" - } - ], - "id": "question3", - "title": "Question Three", - "type": "General" - }, - "skip_conditions": { - "when": { - "==": [ - { - "source": "answers", - "identifier": "answer-two" - }, - 1 - ] - } - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_dob_date.json b/schemas/test/en/test_dob_date.json deleted file mode 100644 index 70581d7670..0000000000 --- a/schemas/test/en/test_dob_date.json +++ /dev/null @@ -1,213 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "999", - "title": "Test Date and DOB routing", - "description": "Tests ", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "date-of-birth", - "question": { - "id": "date-of-birth-question", - "title": "What is your date of birth?", - "type": "General", - "answers": [ - { - "id": "date-of-birth-answer", - "mandatory": false, - "type": "Date", - "maximum": { - "value": "now" - }, - "minimum": { - "value": "1900-01-01" - } - } - ] - }, - "routing_rules": [ - { - "block": "over-sixteen", - "when": { - "<": [ - { - "date": [ - { - "identifier": "date-of-birth-answer", - "source": "answers" - } - ] - }, - { - "date": ["now", { "years": -16 }] - } - ] - } - }, - { - "block": "under-sixteen", - "when": { - ">=": [ - { - "date": [ - { - "identifier": "date-of-birth-answer", - "source": "answers" - } - ] - }, - { - "date": ["now", { "years": -16 }] - } - ] - } - }, - { - "block": "dob-age" - } - ] - }, - { - "type": "Question", - "id": "dob-age", - "question": { - "id": "dob-age-question", - "title": "What is your age?", - "type": "General", - "answers": [ - { - "id": "dob-age-answer", - "unit": "duration-year", - "type": "Unit", - "label": "Your age", - "unit_length": "long", - "mandatory": true, - "maximum": { - "value": 118 - } - } - ] - }, - "routing_rules": [ - { - "block": "over-sixteen", - "when": { - ">=": [ - { - "source": "answers", - "identifier": "dob-age-answer" - }, - 16 - ] - } - }, - { - "block": "under-sixteen" - } - ] - }, - { - "type": "Question", - "id": "over-sixteen", - "question": { - "id": "over-sixteen-question", - "title": "You are over 16!", - "type": "General", - "answers": [ - { - "id": "over-sixteen-answer", - "mandatory": false, - "type": "Date", - "maximum": { - "value": "now" - }, - "minimum": { - "value": "1900-01-01" - } - } - ] - } - }, - { - "type": "Question", - "id": "under-sixteen", - "question": { - "id": "under-sixteen-question", - "title": "You are under 16!", - "type": "General", - "answers": [ - { - "id": "under-sixteen-answer", - "mandatory": false, - "type": "Date", - "maximum": { - "value": "now" - }, - "minimum": { - "value": "1900-01-01" - } - } - ] - }, - "skip_conditions": { - "when": { - "or": [ - { - ">=": [ - { - "source": "answers", - "identifier": "dob-age-answer" - }, - 16 - ] - }, - { - "<": [ - { "date": [{ "identifier": "date-of-birth-answer", "source": "answers" }] }, - { - "date": ["now", { "years": -16 }] - } - ] - } - ] - } - } - } - ], - "id": "test" - } - ] - } - ] -} diff --git a/schemas/test/en/test_dropdown_mandatory.json b/schemas/test/en/test_dropdown_mandatory.json deleted file mode 100644 index 6269db4b3f..0000000000 --- a/schemas/test/en/test_dropdown_mandatory.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Dropdown Mandatory", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "dropdown", - "title": "Dropdown Mandatory", - "blocks": [ - { - "type": "Question", - "id": "dropdown-mandatory", - "question": { - "type": "General", - "id": "dropdown-mandatory-question", - "title": "Which football team do your support?", - "answers": [ - { - "type": "Dropdown", - "id": "dropdown-mandatory-answer", - "mandatory": true, - "label": "Football team", - "description": "Your favourite team from the Premier League.", - "options": [ - { - "label": "Liverpool", - "value": "Liverpool" - }, - { - "label": "Chelsea", - "value": "Chelsea" - }, - { - "label": "Rugby is better!", - "value": "Rugby is better!" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_dropdown_mandatory_with_overridden_error.json b/schemas/test/en/test_dropdown_mandatory_with_overridden_error.json deleted file mode 100644 index 6ecdd5601f..0000000000 --- a/schemas/test/en/test_dropdown_mandatory_with_overridden_error.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Dropdown Mandatory With Overridden Error", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "dropdown", - "title": "Dropdown Mandatory With Overridden Error", - "blocks": [ - { - "type": "Question", - "id": "dropdown-mandatory-with-overridden-error", - "question": { - "type": "General", - "id": "dropdown-mandatory-with-overridden-error-question", - "title": "Which football team do your support?", - "answers": [ - { - "type": "Dropdown", - "id": "dropdown-mandatory-with-overridden-answer", - "mandatory": true, - "label": "Football team", - "options": [ - { - "label": "Liverpool", - "value": "Liverpool" - }, - { - "label": "Chelsea", - "value": "Chelsea" - }, - { - "label": "Rugby is better!", - "value": "Rugby is better!" - } - ], - "validation": { - "messages": { - "MANDATORY_DROPDOWN": "Overridden test error message." - } - } - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_dropdown_optional.json b/schemas/test/en/test_dropdown_optional.json deleted file mode 100644 index 2082e4dd5f..0000000000 --- a/schemas/test/en/test_dropdown_optional.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Dropdown Mandatory", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "dropdown", - "title": "Dropdown Optional", - "blocks": [ - { - "type": "Question", - "id": "dropdown-optional", - "question": { - "type": "General", - "id": "dropdown-optional-question", - "title": "Which football team do your support?", - "answers": [ - { - "type": "Dropdown", - "id": "dropdown-optional-answer", - "mandatory": false, - "label": "Football team", - "description": "Your favourite team from the Premier League.", - "options": [ - { - "label": "Liverpool", - "value": "Liverpool" - }, - { - "label": "Chelsea", - "value": "Chelsea" - }, - { - "label": "Rugby is better!", - "value": "Rugby is better!" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_durations.json b/schemas/test/en/test_durations.json deleted file mode 100644 index fb8c66752a..0000000000 --- a/schemas/test/en/test_durations.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "023", - "title": "Durations", - "description": "A test schema for different durations", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "duration-block", - "question": { - "answers": [ - { - "id": "year-month-answer", - "label": "Years and Months", - "mandatory": false, - "units": ["years", "months"], - "type": "Duration" - }, - { - "id": "mandatory-year-month-answer", - "label": "Mandatory Years and Months", - "mandatory": true, - "units": ["years", "months"], - "type": "Duration" - }, - { - "id": "year-answer", - "label": "Years", - "mandatory": false, - "units": ["years"], - "type": "Duration" - }, - { - "id": "mandatory-year-answer", - "label": "Mandatory Years", - "mandatory": true, - "units": ["years"], - "type": "Duration" - }, - { - "id": "month-answer", - "label": "Months", - "mandatory": false, - "units": ["months"], - "type": "Duration" - }, - { - "id": "mandatory-month-answer", - "label": "Mandatory Months", - "mandatory": true, - "units": ["months"], - "type": "Duration" - } - ], - "id": "duration-question", - "title": "Durations", - "type": "General" - } - } - ], - "id": "durations" - } - ] - } - ] -} diff --git a/schemas/test/en/test_dynamic_answer_options_function_driven.json b/schemas/test/en/test_dynamic_answer_options_function_driven.json deleted file mode 100644 index aebd35f764..0000000000 --- a/schemas/test/en/test_dynamic_answer_options_function_driven.json +++ /dev/null @@ -1,346 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test dynamic answer option driven by the map operator", - "theme": "default", - "description": "A questionnaire to demo dynamic answer options driven by the map operator with no additional static options", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "reference-date", - "question": { - "id": "reference-date-question", - "title": "Enter a reference date to drive the next set of questions", - "type": "General", - "answers": [ - { - "id": "reference-date-answer", - "mandatory": true, - "type": "Date" - } - ] - } - }, - { - "type": "Question", - "id": "dynamic-checkbox", - "question": { - "id": "dynamic-checkbox-question", - "title": { - "text": "In the week of {date}, which days did you work?", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "answers", - "identifier": "reference-date-answer" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "dynamic-checkbox-answer", - "mandatory": false, - "type": "Checkbox", - "dynamic_options": { - "values": { - "map": [ - { - "format-date": ["self", "yyyy-MM-dd"] - }, - { - "date-range": [ - { - "date": [ - { - "source": "answers", - "identifier": "reference-date-answer" - }, - { - "day_of_week": "MONDAY" - } - ] - }, - 7 - ] - } - ] - }, - "transform": { - "format-date": [ - { - "date": ["self"] - }, - "EEEE d MMMM yyyy" - ] - } - } - } - ] - } - }, - { - "type": "Question", - "id": "dynamic-radio", - "question": { - "id": "dynamic-radio-question", - "title": { - "text": "In the week of {date}, which day did you work the most?", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "answers", - "identifier": "reference-date-answer" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "dynamic-radio-answer", - "mandatory": false, - "type": "Radio", - "dynamic_options": { - "values": { - "map": [ - { - "format-date": ["self", "yyyy-MM-dd"] - }, - { - "date-range": [ - { - "date": [ - { - "source": "answers", - "identifier": "reference-date-answer" - }, - { - "day_of_week": "MONDAY" - } - ] - }, - 7 - ] - } - ] - }, - "transform": { - "format-date": [ - { - "date": ["self"] - }, - "EEEE d MMMM yyyy" - ] - } - } - } - ] - } - }, - { - "type": "Question", - "id": "dynamic-dropdown", - "question": { - "id": "dynamic-dropdown-question", - "title": { - "text": "In the week of {date}, which day did you work the least?", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "answers", - "identifier": "reference-date-answer" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "dynamic-dropdown-answer", - "mandatory": false, - "type": "Dropdown", - "label": "Select an option", - "dynamic_options": { - "values": { - "map": [ - { - "format-date": ["self", "yyyy-MM-dd"] - }, - { - "date-range": [ - { - "date": [ - { - "source": "answers", - "identifier": "reference-date-answer" - }, - { - "day_of_week": "MONDAY" - } - ] - }, - 7 - ] - } - ] - }, - "transform": { - "format-date": [ - { - "date": ["self"] - }, - "EEEE d MMMM yyyy" - ] - } - } - } - ] - } - }, - { - "type": "Question", - "id": "dynamic-mutually-exclusive", - "question": { - "id": "dynamic-mutually-exclusive-question", - "title": { - "text": "In the week of {date}, which days did you book annual leave?", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "answers", - "identifier": "reference-date-answer" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "MutuallyExclusive", - "mandatory": false, - "answers": [ - { - "id": "dynamic-mutually-exclusive-dynamic-answer", - "mandatory": false, - "type": "Checkbox", - "label": "Select an option", - "dynamic_options": { - "values": { - "map": [ - { - "format-date": ["self", "yyyy-MM-dd"] - }, - { - "date-range": [ - { - "date": [ - { - "source": "answers", - "identifier": "reference-date-answer" - }, - { - "day_of_week": "MONDAY" - } - ] - }, - 7 - ] - } - ] - }, - "transform": { - "format-date": [ - { - "date": ["self"] - }, - "EEEE d MMMM yyyy" - ] - } - } - }, - { - "id": "dynamic-mutually-exclusive-static-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I did not work", - "value": "I did not work" - } - ] - } - ] - } - } - ], - "id": "group-1" - } - ] - } - ] -} diff --git a/schemas/test/en/test_dynamic_answer_options_function_driven_with_static_options.json b/schemas/test/en/test_dynamic_answer_options_function_driven_with_static_options.json deleted file mode 100644 index 94117b7672..0000000000 --- a/schemas/test/en/test_dynamic_answer_options_function_driven_with_static_options.json +++ /dev/null @@ -1,370 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test dynamic answer option driven by the map operator", - "theme": "default", - "description": "A questionnaire to demo dynamic answer options driven by the map operator with additional static options", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "reference-date", - "question": { - "id": "reference-date-question", - "title": "Enter a reference date to drive the next set of questions", - "type": "General", - "answers": [ - { - "id": "reference-date-answer", - "mandatory": true, - "type": "Date" - } - ] - } - }, - { - "type": "Question", - "id": "dynamic-checkbox", - "question": { - "id": "dynamic-checkbox-question", - "title": { - "text": "In the week of {date}, which days did you work?", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "answers", - "identifier": "reference-date-answer" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "dynamic-checkbox-answer", - "mandatory": false, - "type": "Checkbox", - "dynamic_options": { - "values": { - "map": [ - { - "format-date": ["self", "yyyy-MM-dd"] - }, - { - "date-range": [ - { - "date": [ - { - "source": "answers", - "identifier": "reference-date-answer" - }, - { - "day_of_week": "MONDAY" - } - ] - }, - 7 - ] - } - ] - }, - "transform": { - "format-date": [ - { - "date": ["self"] - }, - "EEEE d MMMM yyyy" - ] - } - }, - "options": [ - { - "label": "I did not work", - "value": "I did not work" - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "dynamic-radio", - "question": { - "id": "dynamic-radio-question", - "title": { - "text": "In the week of {date}, which day did you work the most?", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "answers", - "identifier": "reference-date-answer" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "dynamic-radio-answer", - "mandatory": false, - "type": "Radio", - "dynamic_options": { - "values": { - "map": [ - { - "format-date": ["self", "yyyy-MM-dd"] - }, - { - "date-range": [ - { - "date": [ - { - "source": "answers", - "identifier": "reference-date-answer" - }, - { - "day_of_week": "MONDAY" - } - ] - }, - 7 - ] - } - ] - }, - "transform": { - "format-date": [ - { - "date": ["self"] - }, - "EEEE d MMMM yyyy" - ] - } - }, - "options": [ - { - "label": "I did not work", - "value": "I did not work" - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "dynamic-dropdown", - "question": { - "id": "dynamic-dropdown-question", - "title": { - "text": "In the week of {date}, which day did you work the least?", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "answers", - "identifier": "reference-date-answer" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "dynamic-dropdown-answer", - "mandatory": false, - "type": "Dropdown", - "label": "Select an option", - "dynamic_options": { - "values": { - "map": [ - { - "format-date": ["self", "yyyy-MM-dd"] - }, - { - "date-range": [ - { - "date": [ - { - "source": "answers", - "identifier": "reference-date-answer" - }, - { - "day_of_week": "MONDAY" - } - ] - }, - 7 - ] - } - ] - }, - "transform": { - "format-date": [ - { - "date": ["self"] - }, - "EEEE d MMMM yyyy" - ] - } - }, - "options": [ - { - "label": "I did not work", - "value": "I did not work" - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "dynamic-mutually-exclusive", - "question": { - "id": "dynamic-mutually-exclusive-question", - "title": { - "text": "In the week of {date}, which days did you book annual leave?", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "answers", - "identifier": "reference-date-answer" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "MutuallyExclusive", - "mandatory": false, - "answers": [ - { - "id": "dynamic-mutually-exclusive-dynamic-answer", - "mandatory": false, - "type": "Checkbox", - "label": "Select an option", - "dynamic_options": { - "values": { - "map": [ - { - "format-date": ["self", "yyyy-MM-dd"] - }, - { - "date-range": [ - { - "date": [ - { - "source": "answers", - "identifier": "reference-date-answer" - }, - { - "day_of_week": "MONDAY" - } - ] - }, - 7 - ] - } - ] - }, - "transform": { - "format-date": [ - { - "date": ["self"] - }, - "EEEE d MMMM yyyy" - ] - } - }, - "options": [ - { - "label": "None of the above", - "value": "None of the above" - } - ] - }, - { - "id": "dynamic-mutually-exclusive-static-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I did not work", - "value": "I did not work" - } - ] - } - ] - } - } - ], - "id": "group-1" - } - ] - } - ] -} diff --git a/schemas/test/en/test_dynamic_answer_options_function_driven_with_static_options_mandatory.json b/schemas/test/en/test_dynamic_answer_options_function_driven_with_static_options_mandatory.json deleted file mode 100644 index 45962f6437..0000000000 --- a/schemas/test/en/test_dynamic_answer_options_function_driven_with_static_options_mandatory.json +++ /dev/null @@ -1,370 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test dynamic answer option driven by the map operator", - "theme": "default", - "description": "A questionnaire to demo dynamic answer options driven by the map operator with additional static options", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "reference-date", - "question": { - "id": "reference-date-question", - "title": "Enter a reference date to drive the next set of questions", - "type": "General", - "answers": [ - { - "id": "reference-date-answer", - "mandatory": true, - "type": "Date" - } - ] - } - }, - { - "type": "Question", - "id": "dynamic-checkbox", - "question": { - "id": "dynamic-checkbox-question", - "title": { - "text": "In the week of {date}, which days did you work?", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "answers", - "identifier": "reference-date-answer" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "dynamic-checkbox-answer", - "mandatory": true, - "type": "Checkbox", - "dynamic_options": { - "values": { - "map": [ - { - "format-date": ["self", "yyyy-MM-dd"] - }, - { - "date-range": [ - { - "date": [ - { - "source": "answers", - "identifier": "reference-date-answer" - }, - { - "day_of_week": "MONDAY" - } - ] - }, - 7 - ] - } - ] - }, - "transform": { - "format-date": [ - { - "date": ["self"] - }, - "EEEE d MMMM yyyy" - ] - } - }, - "options": [ - { - "label": "I did not work", - "value": "I did not work" - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "dynamic-radio", - "question": { - "id": "dynamic-radio-question", - "title": { - "text": "In the week of {date}, which day did you work the most?", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "answers", - "identifier": "reference-date-answer" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "dynamic-radio-answer", - "mandatory": true, - "type": "Radio", - "dynamic_options": { - "values": { - "map": [ - { - "format-date": ["self", "yyyy-MM-dd"] - }, - { - "date-range": [ - { - "date": [ - { - "source": "answers", - "identifier": "reference-date-answer" - }, - { - "day_of_week": "MONDAY" - } - ] - }, - 7 - ] - } - ] - }, - "transform": { - "format-date": [ - { - "date": ["self"] - }, - "EEEE d MMMM yyyy" - ] - } - }, - "options": [ - { - "label": "I did not work", - "value": "I did not work" - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "dynamic-dropdown", - "question": { - "id": "dynamic-dropdown-question", - "title": { - "text": "In the week of {date}, which day did you work the least?", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "answers", - "identifier": "reference-date-answer" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "dynamic-dropdown-answer", - "mandatory": true, - "type": "Dropdown", - "label": "Select an option", - "dynamic_options": { - "values": { - "map": [ - { - "format-date": ["self", "yyyy-MM-dd"] - }, - { - "date-range": [ - { - "date": [ - { - "source": "answers", - "identifier": "reference-date-answer" - }, - { - "day_of_week": "MONDAY" - } - ] - }, - 7 - ] - } - ] - }, - "transform": { - "format-date": [ - { - "date": ["self"] - }, - "EEEE d MMMM yyyy" - ] - } - }, - "options": [ - { - "label": "I did not work", - "value": "I did not work" - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "dynamic-mutually-exclusive", - "question": { - "id": "dynamic-mutually-exclusive-question", - "title": { - "text": "In the week of {date}, which days did you book annual leave?", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "answers", - "identifier": "reference-date-answer" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "MutuallyExclusive", - "mandatory": true, - "answers": [ - { - "id": "dynamic-mutually-exclusive-dynamic-answer", - "mandatory": false, - "type": "Checkbox", - "label": "Select an option", - "dynamic_options": { - "values": { - "map": [ - { - "format-date": ["self", "yyyy-MM-dd"] - }, - { - "date-range": [ - { - "date": [ - { - "source": "answers", - "identifier": "reference-date-answer" - }, - { - "day_of_week": "MONDAY" - } - ] - }, - 7 - ] - } - ] - }, - "transform": { - "format-date": [ - { - "date": ["self"] - }, - "EEEE d MMMM yyyy" - ] - } - }, - "options": [ - { - "label": "None of the above", - "value": "None of the above" - } - ] - }, - { - "id": "dynamic-mutually-exclusive-static-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I did not work", - "value": "I did not work" - } - ] - } - ] - } - } - ], - "id": "group-1" - } - ] - } - ] -} diff --git a/schemas/test/en/test_dynamic_answers_list_source.json b/schemas/test/en/test_dynamic_answers_list_source.json deleted file mode 100644 index b77837d41d..0000000000 --- a/schemas/test/en/test_dynamic_answers_list_source.json +++ /dev/null @@ -1,588 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Dynamic Answers List Source", - "theme": "default", - "description": "A questionnaire to demo dynamic answers list source.", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { "required_completed_sections": ["list-collector-section"] } - }, - "sections": [ - { - "id": "list-collector-section", - "title": "Supermarket Shopping Section", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "supermarkets", - "title": "Household members", - "add_link_text": "Add another supermarket", - "empty_list_text": "There are no supermarkets" - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "list-collector-group", - "blocks": [ - { - "type": "ListCollectorDrivingQuestion", - "id": "any-supermarket", - "for_list": "supermarkets", - "question": { - "type": "General", - "id": "any-supermarket-question", - "title": "Do you need to add any supermarkets?", - "answers": [ - { - "type": "Radio", - "id": "any-supermarket-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-supermarket", - "list_name": "supermarkets" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "section": "End", - "when": { - "==": [ - { - "source": "answers", - "identifier": "any-supermarket-answer" - }, - "No" - ] - } - }, - { - "block": "list-collector" - } - ] - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "supermarkets", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Do you need to add any more supermarkets?", - "answers": [ - { - "id": "list-collector-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-supermarket", - "type": "ListAddQuestion", - "cancel_text": "Don’t need to add any other supermarkets?", - "question": { - "guidance": { - "contents": [ - { - "description": "Maximum spending value will be used for each supermarket’s max spending validation and placeholders." - } - ] - }, - "id": "add-question", - "type": "General", - "title": "Which supermarkets do you use for your weekly shopping?", - "answers": [ - { - "id": "supermarket-name", - "label": "Supermarket", - "mandatory": true, - "type": "TextField" - }, - { - "id": "set-maximum", - "description": "Maximum amount of spending at this supermarket, should be between 1001 and 10000", - "label": "Maximum Spending", - "mandatory": true, - "type": "Number", - "decimal_places": 2, - "minimum": { - "value": 1001 - }, - "maximum": { - "value": 10000 - } - } - ] - } - }, - "edit_block": { - "id": "edit-supermarket", - "type": "ListEditQuestion", - "cancel_text": "Don’t need to change anything?", - "question": { - "guidance": { - "contents": [ - { - "description": "Maximum spending value will be used for each supermarket’s max spending validation and placeholders." - } - ] - }, - "id": "edit-question", - "type": "General", - "title": "What is the name of the supermarket?", - "answers": [ - { - "id": "supermarket-name", - "label": "Supermarket", - "mandatory": true, - "type": "TextField" - }, - { - "id": "set-maximum", - "description": "Maximum amount of spending at this supermarket", - "label": "Maximum amount of spending", - "mandatory": true, - "type": "Number", - "decimal_places": 2, - "minimum": { - "value": 1001 - }, - "maximum": { - "value": 10000 - } - } - ] - } - }, - "remove_block": { - "id": "remove-supermarket", - "type": "ListRemoveQuestion", - "cancel_text": "Don’t need to remove this supermarket?", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this supermarket?", - "warning": "All of the information about this supermarket will be deleted", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Supermarkets", - "item_title": { - "text": "{supermarket_name}", - "placeholders": [ - { - "placeholder": "supermarket_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "supermarket-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "type": "Question", - "id": "dynamic-answer", - "skip_conditions": { - "when": { - "==": [ - { - "count": [ - { - "source": "list", - "identifier": "supermarkets" - } - ] - }, - 0 - ] - } - }, - "question": { - "dynamic_answers": { - "values": { - "source": "list", - "identifier": "supermarkets" - }, - "answers": [ - { - "label": { - "text": "Percentage of shopping at {transformed_value}", - "placeholders": [ - { - "placeholder": "transformed_value", - "value": { - "source": "answers", - "identifier": "supermarket-name" - } - } - ] - }, - "id": "percentage-of-shopping", - "mandatory": false, - "type": "Percentage", - "maximum": { - "value": 100 - }, - "decimal_places": 0 - }, - { - "id": "days-a-week", - "label": { - "text": "How many days a week you shop at {transformed_value}", - "placeholders": [ - { - "placeholder": "transformed_value", - "value": { - "source": "answers", - "identifier": "supermarket-name" - } - } - ] - }, - "mandatory": false, - "type": "Number", - "decimal_places": 0, - "minimum": { - "value": 1 - }, - "maximum": { - "value": 7 - } - } - ] - }, - "answers": [ - { - "id": "based-checkbox-answer", - "label": "Are supermarkets UK or non UK based?", - "instruction": "Select any answers that apply", - "mandatory": false, - "options": [ - { - "label": "UK based supermarkets", - "value": "UK based supermarkets" - }, - { - "label": "Non UK based supermarkets", - "value": "Non UK based supermarkets" - } - ], - "type": "Checkbox" - } - ], - "id": "dynamic-answer-question", - "title": "What percent of your shopping do you do at each of the following supermarket?", - "type": "General" - } - }, - { - "type": "Question", - "id": "minimum-spending", - "question": { - "guidance": { - "contents": [ - { - "description": "This value will be used for all supermarkets minimum spending validation and placeholders." - } - ] - }, - "answers": [ - { - "id": "set-minimum", - "label": "Minimum Spending", - "description": "Minium amount of spending at all supermarkets", - "mandatory": true, - "type": "Number", - "decimal_places": 2, - "minimum": { - "value": 0 - }, - "maximum": { - "value": 1000 - } - } - ], - "id": "minimum-spending-question", - "title": "What is your minimum amount of spending?", - "type": "General" - } - }, - { - "type": "Question", - "id": "dynamic-answer-only", - "skip_conditions": { - "when": { - "==": [ - { - "count": [ - { - "source": "list", - "identifier": "supermarkets" - } - ] - }, - 0 - ] - } - }, - "question": { - "guidance": { - "contents": [ - { - "description": "Answers are validated against values piped from previous questions, maximum from repeated question for each supermarket, minimum from non-repeated question. Answer label’s placeholders are resolved from these as well." - } - ] - }, - "dynamic_answers": { - "values": { - "source": "list", - "identifier": "supermarkets" - }, - "answers": [ - { - "label": { - "text": "How much do you spend at {transformed_value}", - "placeholders": [ - { - "placeholder": "transformed_value", - "value": { - "source": "answers", - "identifier": "supermarket-name" - } - } - ] - }, - "id": "amount-of-shopping", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "description": { - "text": "The answers must be less than or equal {max_value} and greater than or equal {min_value}", - "placeholders": [ - { - "placeholder": "min_value", - "value": { - "source": "answers", - "identifier": "set-minimum" - } - }, - { - "placeholder": "max_value", - "value": { - "source": "answers", - "identifier": "set-maximum" - } - } - ] - }, - "maximum": { - "value": { - "source": "answers", - "identifier": "set-maximum" - } - }, - "minimum": { - "value": { - "source": "answers", - "identifier": "set-minimum" - } - } - } - ] - }, - "id": "dynamic-answer-only-question", - "title": "How much do you spend at each of the following supermarket?", - "type": "General" - } - } - ] - } - ] - }, - { - "id": "dynamic-answers-section", - "title": "Online Shopping Section", - "enabled": { - "when": { - "==": [ - "Yes", - { - "source": "answers", - "identifier": "any-supermarket-answer" - } - ] - } - }, - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "id": "dynamic-answers-group", - "blocks": [ - { - "type": "Question", - "id": "dynamic-answer-separate-section", - "skip_conditions": { - "when": { - "==": [ - { - "count": [ - { - "source": "list", - "identifier": "supermarkets" - } - ] - }, - 0 - ] - } - }, - "question": { - "dynamic_answers": { - "values": { - "source": "list", - "identifier": "supermarkets" - }, - "answers": [ - { - "label": { - "text": "Percentage of online shopping at {transformed_value}", - "placeholders": [ - { - "placeholder": "transformed_value", - "value": { - "source": "answers", - "identifier": "supermarket-name" - } - } - ] - }, - "id": "percentage-of-online-shopping", - "mandatory": false, - "type": "Percentage", - "maximum": { - "value": 100 - }, - "decimal_places": 0 - }, - { - "id": "online-days-a-week", - "label": { - "text": "How many days a week do you shop online at {transformed_value}", - "placeholders": [ - { - "placeholder": "transformed_value", - "value": { - "source": "answers", - "identifier": "supermarket-name" - } - } - ] - }, - "mandatory": false, - "type": "Number", - "decimal_places": 0, - "minimum": { - "value": 1 - }, - "maximum": { - "value": 7 - } - } - ] - }, - "id": "dynamic-answer-online-question", - "title": "What percent of your online shopping do you do at each of the following supermarket?", - "type": "General" - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_dynamic_radio_options_from_checkbox.json b/schemas/test/en/test_dynamic_radio_options_from_checkbox.json deleted file mode 100644 index 75eb976a2b..0000000000 --- a/schemas/test/en/test_dynamic_radio_options_from_checkbox.json +++ /dev/null @@ -1,134 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test dynamic radio answer options from checkbox", - "theme": "default", - "description": "A questionnaire to demo dynamic radio answer options from checkbox answers", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "injury-sustained-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "injury-sustained", - "question": { - "answers": [ - { - "id": "injury-sustained-answer", - "mandatory": true, - "options": [ - { - "label": "Head", - "value": "Head" - }, - { - "label": "Body", - "value": "Body" - }, - { - "label": "Arms", - "value": "Arms" - }, - { - "label": "Legs", - "value": "Legs" - } - ], - "type": "Checkbox" - } - ], - "id": "injury-sustained-question", - "title": "When you had the injury, where did you sustain injuries?", - "type": "General" - } - }, - { - "type": "Question", - "id": "most-serious-injury", - "question": { - "id": "most-serious-injury-question", - "title": "Which was the most serious injury", - "type": "General", - "answers": [ - { - "id": "most-serious-injury-answer", - "mandatory": false, - "type": "Radio", - "dynamic_options": { - "values": { - "source": "answers", - "identifier": "injury-sustained-answer" - }, - "transform": { - "option-label-from-value": ["self", "injury-sustained-answer"] - } - }, - "options": [ - { - "label": "They were of equal severity (static option)", - "value": "They were of equal severity (static option)" - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "healed-the-quickest", - "question": { - "id": "healed-the-quickest-question", - "title": "Which injury healed the quickest", - "type": "General", - "answers": [ - { - "id": "healed-the-quickest-answer", - "mandatory": false, - "type": "Radio", - "dynamic_options": { - "values": { - "source": "answers", - "identifier": "injury-sustained-answer" - }, - "transform": { - "option-label-from-value": ["self", "injury-sustained-answer"] - } - } - } - ] - } - } - ], - "id": "injury-group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_feedback.json b/schemas/test/en/test_feedback.json deleted file mode 100644 index 950b2c0b2a..0000000000 --- a/schemas/test/en/test_feedback.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Feedback test schema", - "theme": "default", - "form_type": "H", - "description": "A questionnaire to test feedback", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "post_submission": { - "feedback": true - }, - "sections": [ - { - "id": "schema-feedback-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "feedback", - "question": { - "answers": [ - { - "type": "Radio", - "id": "schema-feedback-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ], - "id": "schema-feedback-question", - "title": "Are you aware you can send feedback with this schema?", - "type": "General" - } - } - ], - "id": "schema-feedback-group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_feedback_email_confirmation.json b/schemas/test/en/test_feedback_email_confirmation.json deleted file mode 100644 index 0a18b7b9e7..0000000000 --- a/schemas/test/en/test_feedback_email_confirmation.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Feedback test schema", - "theme": "default", - "description": "A questionnaire to test feedback", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "post_submission": { - "feedback": true, - "confirmation_email": true - }, - "sections": [ - { - "id": "schema-feedback-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "feedback", - "question": { - "answers": [ - { - "type": "Radio", - "id": "schema-feedback-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ], - "id": "schema-feedback-question", - "title": "Are you aware you can send feedback with this schema?", - "type": "General" - } - } - ], - "id": "schema-feedback-group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_grand_calculated_summary.json b/schemas/test/en/test_grand_calculated_summary.json deleted file mode 100644 index e2271d03b9..0000000000 --- a/schemas/test/en/test_grand_calculated_summary.json +++ /dev/null @@ -1,294 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Simple Grand Calculated Summary demo", - "theme": "default", - "description": "A schema to showcase Grand Calculated Summary.", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section-1", - "title": "Commuting", - "groups": [ - { - "id": "group", - "title": "Commuting", - "blocks": [ - { - "type": "Question", - "id": "first-number-block", - "question": { - "id": "first-number-question", - "title": "How much do you walk per week?", - "type": "General", - "answers": [ - { - "id": "q1-a1", - "label": "Weekly distance travelled on foot", - "mandatory": true, - "type": "Unit", - "unit_length": "short", - "unit": "length-mile", - "decimal_places": 2 - }, - { - "id": "q1-a2", - "label": "Number of walks per week", - "mandatory": true, - "type": "Number" - } - ] - } - }, - { - "type": "Question", - "id": "second-number-block", - "question": { - "id": "second-number-question", - "title": "How much do you drive per week?", - "type": "General", - "answers": [ - { - "id": "q2-a1", - "label": "Weekly distance travelled by car", - "mandatory": true, - "type": "Unit", - "unit_length": "short", - "unit": "length-mile", - "decimal_places": 2 - }, - { - "id": "q2-a2", - "label": "Number of car journeys per week", - "mandatory": true, - "type": "Number" - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "distance-calculated-summary-1", - "title": "We calculate the total of distance travelled by foot and car to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "q1-a1" - }, - { - "source": "answers", - "identifier": "q2-a1" - } - ] - }, - "title": "Calculated distance on foot and driving" - } - }, - { - "type": "CalculatedSummary", - "id": "number-calculated-summary-1", - "title": "We calculate the total number of journeys on foot and in a car to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "q1-a2" - }, - { - "source": "answers", - "identifier": "q2-a2" - } - ] - }, - "title": "Calculated journeys on foot and driving" - } - } - ] - } - ] - }, - { - "id": "section-2", - "title": "Alternative Transport", - "groups": [ - { - "id": "transport-group", - "title": "Alternative Transport", - "blocks": [ - { - "type": "Question", - "id": "third-number-block", - "question": { - "id": "third-number-question", - "title": "How much do you cycle per week?", - "type": "General", - "answers": [ - { - "id": "q3-a1", - "label": "Weekly distance travelled by bike", - "mandatory": true, - "type": "Unit", - "unit_length": "short", - "unit": "length-mile", - "decimal_places": 2 - }, - { - "id": "q3-a2", - "label": "Number of bicycle journeys per week", - "mandatory": true, - "type": "Number" - } - ] - } - }, - { - "type": "Question", - "id": "fourth-number-block", - "question": { - "id": "fourth-number-question", - "title": "How much do you voi per week?", - "type": "General", - "answers": [ - { - "id": "q4-a1", - "label": "Weekly distance travelled on a Voi", - "mandatory": true, - "type": "Unit", - "unit_length": "short", - "unit": "length-mile", - "decimal_places": 2 - }, - { - "id": "q4-a2", - "label": "Number of scooter trips per week", - "mandatory": true, - "type": "Number" - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "distance-calculated-summary-2", - "title": "We calculate the total of distance travelled by bike and voi to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "q3-a1" - }, - { - "source": "answers", - "identifier": "q4-a1" - } - ] - }, - "title": "Calculated weekly distance on bike and scooter" - } - }, - { - "type": "CalculatedSummary", - "id": "number-calculated-summary-2", - "title": "We calculate the total number of journeys on bike and on a voi to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "q3-a2" - }, - { - "source": "answers", - "identifier": "q4-a2" - } - ] - }, - "title": "Calculated journeys on bike and scooter" - } - } - ] - } - ] - }, - { - "id": "section-3", - "title": "Grand calculated summaries", - "groups": [ - { - "id": "summary-group", - "title": "Grand calculated summary group", - "blocks": [ - { - "type": "GrandCalculatedSummary", - "id": "distance-grand-calculated-summary", - "title": "We calculate the grand total weekly distance travelled to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "calculated_summary", - "identifier": "distance-calculated-summary-1" - }, - { - "source": "calculated_summary", - "identifier": "distance-calculated-summary-2" - } - ] - }, - "title": "Grand calculated summary of distance travelled" - } - }, - { - "type": "GrandCalculatedSummary", - "id": "number-grand-calculated-summary", - "title": "We calculate the grand total journeys per week to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "calculated_summary", - "identifier": "number-calculated-summary-1" - }, - { - "source": "calculated_summary", - "identifier": "number-calculated-summary-2" - } - ] - }, - "title": "Grand calculated summary of journeys" - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_grand_calculated_summary_cross_section_dependencies.json b/schemas/test/en/test_grand_calculated_summary_cross_section_dependencies.json deleted file mode 100644 index 61512e3003..0000000000 --- a/schemas/test/en/test_grand_calculated_summary_cross_section_dependencies.json +++ /dev/null @@ -1,368 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Grand Calculated Summary Cross Section Dependencies", - "theme": "default", - "description": "A questionnaire to demo resolution of grand calculated summary values across sections", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "questions-section", - "title": "Household bills", - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "id": "radio", - "title": "Questions", - "blocks": [ - { - "type": "Question", - "id": "skip-first-block", - "question": { - "type": "General", - "id": "skip-question-1", - "title": "Are you a student?", - "guidance": { - "contents": [ - { - "description": "If you answer yes, then the question about council tax will be skipped and not included in total monthly expenditure." - } - ] - }, - "answers": [ - { - "type": "Radio", - "id": "skip-answer-1", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "skip-answer-1", - "source": "answers" - }, - "Yes" - ] - } - }, - "type": "Question", - "id": "first-number-block-part-a", - "question": { - "id": "question-1-a", - "title": "How much do you pay monthly for council tax?", - "type": "General", - "answers": [ - { - "id": "first-number-answer-a", - "label": "Council tax (optional)", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "second-number-block", - "question": { - "id": "question-2", - "title": "How much are your monthly gas, water and electricity bills?", - "type": "General", - "answers": [ - { - "id": "second-number-answer-a", - "label": "Electricity Bill", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "second-number-answer-b", - "label": "Gas Bill", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "second-number-answer-c", - "label": "Water Bill", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "currency-section-1", - "title": "We calculate your total monthly expenditure on household bills to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "second-number-answer-a" - }, - { - "source": "answers", - "identifier": "second-number-answer-b" - }, - { - "source": "answers", - "identifier": "second-number-answer-c" - }, - { - "source": "answers", - "identifier": "first-number-answer-a" - } - ] - }, - "title": "Monthly expenditure on household bills" - } - } - ] - } - ] - }, - { - "id": "calculated-summary-section", - "title": "Other outgoing costs", - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "id": "calculated-summary", - "blocks": [ - { - "type": "Question", - "id": "third-number-block", - "question": { - "id": "third-number-question", - "title": "How much do you spend on internet and television?", - "type": "General", - "guidance": { - "contents": [ - { - "description": "If you enter a value for the TV licence, it will unlock an additional question about premium channels." - } - ] - }, - "answers": [ - { - "id": "third-number-answer-part-a", - "label": "Internet bill", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "third-number-answer-part-b", - "label": "TV licence (optional)", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "third-number-answer-part-b", - "source": "answers" - }, - null - ] - } - }, - "type": "Question", - "id": "fourth-number-block", - "question": { - "id": "fourth-number-question", - "title": "How much do you spend per month on premium television channels?", - "type": "General", - "answers": [ - { - "id": "fourth-number-answer", - "label": "TV channel subscription fees", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "skip-calculated-summary", - "question": { - "type": "General", - "id": "skip-question-2", - "title": "Skip the calculated summary of other outgoing costs so it isn’t included in the grand calculated summary?", - "answers": [ - { - "type": "Radio", - "id": "skip-answer-2", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "skip-answer-2", - "source": "answers" - }, - "Yes" - ] - } - }, - "type": "CalculatedSummary", - "id": "currency-question-3", - "title": "We calculate the total monthly spending on internet and TV to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "third-number-answer-part-a" - }, - { - "source": "answers", - "identifier": "third-number-answer-part-b" - }, - { - "source": "answers", - "identifier": "fourth-number-answer" - } - ] - }, - "title": "Total monthly spending on internet and TV" - } - }, - { - "id": "tv-choice-block", - "type": "Question", - "question": { - "id": "tv-choice-question", - "title": "Do you prefer to watch films on a television or computer?", - "type": "General", - "answers": [ - { - "id": "tv-choice-answer", - "label": "Preferred platform", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Television", - "value": "Television" - }, - { - "label": "Computer", - "value": "Computer" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "grand-calculated-summary-section", - "title": "Grand Calculated Summary", - "groups": [ - { - "id": "grand-calculated-summary", - "blocks": [ - { - "type": "GrandCalculatedSummary", - "id": "currency-all", - "title": "The grand calculated summary is calculated to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "calculated_summary", - "identifier": "currency-section-1" - }, - { - "source": "calculated_summary", - "identifier": "currency-question-3" - } - ] - }, - "title": "Grand total monthly expenditure" - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_grand_calculated_summary_inside_repeating_section.json b/schemas/test/en/test_grand_calculated_summary_inside_repeating_section.json deleted file mode 100644 index 41930c4a5e..0000000000 --- a/schemas/test/en/test_grand_calculated_summary_inside_repeating_section.json +++ /dev/null @@ -1,1109 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Grand Calculated Summary Inside Repeating Section", - "theme": "default", - "description": "A schema to showcase a grand calculated summary inside a repeating section", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "base-costs-section", - "title": "Vehicle Costs", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "costs", - "title": "Base Costs", - "add_link_text": "Add another base cost", - "empty_list_text": "There are no base costs" - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "base-costs-group", - "blocks": [ - { - "type": "ListCollectorDrivingQuestion", - "id": "any-cost", - "for_list": "costs", - "question": { - "type": "General", - "id": "any-cost-question", - "title": "Do you have any outgoing costs for owning a vehicle?", - "answers": [ - { - "type": "Radio", - "id": "any-cost-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-cost", - "list_name": "costs" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "finance-cost", - "when": { - "==": [ - { - "source": "answers", - "identifier": "any-cost-answer" - }, - "No" - ] - } - }, - { - "block": "list-collector-cost" - } - ] - }, - { - "id": "list-collector-cost", - "type": "ListCollector", - "for_list": "costs", - "question": { - "id": "confirmation-cost-question", - "type": "General", - "title": "Do you need to add other outgoing costs?", - "answers": [ - { - "id": "list-collector-cost-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-cost", - "type": "ListAddQuestion", - "cancel_text": "Don’t need to add any other outgoing costs?", - "question": { - "id": "add-cost-question", - "type": "General", - "title": "What outgoing cost do you have?", - "answers": [ - { - "id": "cost-name", - "label": "Outgoing cost", - "mandatory": true, - "type": "Dropdown", - "options": [ - { - "label": "Road Tax", - "value": "Road Tax" - }, - { - "label": "Parking Permit", - "value": "Parking Permit" - } - ] - } - ] - } - }, - "edit_block": { - "id": "edit-cost", - "type": "ListEditQuestion", - "cancel_text": "Don’t need to change anything?", - "question": { - "id": "edit-cost-question", - "type": "General", - "title": "What outgoing cost do you have?", - "answers": [ - { - "id": "cost-name", - "label": "Outgoing cost", - "mandatory": true, - "type": "Dropdown", - "options": [ - { - "label": "Road Tax", - "value": "Road Tax" - }, - { - "label": "Parking Permit", - "value": "Parking Permit" - } - ] - } - ] - } - }, - "remove_block": { - "id": "remove-cost", - "type": "ListRemoveQuestion", - "cancel_text": "Don’t need to remove this outgoing cost?", - "question": { - "id": "remove-cost-question", - "type": "General", - "title": "Are you sure you want to remove this outgoing cost?", - "warning": "All of the information about this outgoing cost will be deleted", - "answers": [ - { - "id": "remove-cost-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "repeating_blocks": [ - { - "id": "cost-repeating-block-1", - "type": "ListRepeatingQuestion", - "question": { - "id": "cost-repeating-block-1-question", - "type": "General", - "title": { - "text": "What is the base monthly rate for {cost_name} for a single vehicle?", - "placeholders": [ - { - "placeholder": "cost_name", - "value": { - "source": "answers", - "identifier": "cost-name" - } - } - ] - }, - "answers": [ - { - "id": "repeating-block-1-cost-base", - "label": { - "text": "Base {transformed_value} expenditure", - "placeholders": [ - { - "placeholder": "transformed_value", - "value": { - "source": "answers", - "identifier": "cost-name" - } - } - ] - }, - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - } - ], - "summary": { - "title": "cost", - "item_title": { - "text": "{cost_name}", - "placeholders": [ - { - "placeholder": "cost_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "cost-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "type": "Question", - "id": "dynamic-cost-block", - "skip_conditions": { - "when": { - "==": [ - { - "count": [ - { - "source": "list", - "identifier": "costs" - } - ] - }, - 0 - ] - } - }, - "question": { - "id": "dynamic-answer-question", - "title": "How much extra do you normally spend per month for a single vehicle?", - "type": "General", - "dynamic_answers": { - "values": { - "source": "list", - "identifier": "costs" - }, - "answers": [ - { - "label": { - "text": "Extra {transformed_value} expenditure", - "placeholders": [ - { - "placeholder": "transformed_value", - "value": { - "source": "answers", - "identifier": "cost-name" - } - } - ] - }, - "id": "dynamic-answer-cost-extra", - "type": "Currency", - "mandatory": false, - "currency": "GBP", - "decimal_places": 2 - } - ] - } - } - }, - { - "id": "finance-cost", - "type": "Question", - "question": { - "id": "finance-cost-question", - "type": "General", - "title": "What is your monthly expenditure per vehicle on finance?", - "answers": [ - { - "id": "finance-cost-answer", - "label": "Vehicle monthly finance costs", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-base-cost", - "title": "We calculate the total base cost for any owned vehicle to be %(total)s. Is this correct?", - "calculation": { - "title": "Vehicle base cost", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "repeating-block-1-cost-base" - }, - { - "source": "answers", - "identifier": "dynamic-answer-cost-extra" - }, - { - "source": "answers", - "identifier": "finance-cost-answer" - } - ] - } - } - }, - { - "type": "Question", - "id": "base-cost-payment-breakdown", - "question": { - "type": "Calculated", - "id": "base-cost-payment-breakdown-question", - "title": { - "text": "How much of the {total} is paid by debit or credit card?", - "placeholders": [ - { - "placeholder": "total", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "source": "calculated_summary", - "identifier": "calculated-summary-base-cost" - } - } - } - ] - } - ] - }, - "warning": "The sum of these answers must not exceed the total", - "calculations": [ - { - "calculation_type": "sum", - "value": { - "source": "calculated_summary", - "identifier": "calculated-summary-base-cost" - }, - "answers_to_calculate": ["base-credit", "base-debit"], - "conditions": ["less than", "equals"] - } - ], - "answers": [ - { - "id": "base-credit", - "label": "Credit card", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "base-debit", - "label": "Debit card", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - } - ] - } - ] - }, - { - "id": "vehicles-section", - "title": "Vehicle Ownership", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "vehicles", - "title": "Vehicles", - "add_link_text": "Add another vehicle", - "empty_list_text": "There are no vehicles" - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "vehicles-group", - "blocks": [ - { - "type": "ListCollectorDrivingQuestion", - "id": "any-vehicle", - "for_list": "vehicles", - "question": { - "type": "General", - "id": "any-vehicle-question", - "title": "Do you own any vehicles?", - "answers": [ - { - "type": "Radio", - "id": "any-vehicle-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-vehicle", - "list_name": "vehicles" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "section": "End", - "when": { - "==": [ - { - "source": "answers", - "identifier": "any-vehicle-answer" - }, - "No" - ] - } - }, - { - "block": "list-collector" - } - ] - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "vehicles", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Do you need to add more vehicles?", - "answers": [ - { - "id": "list-collector-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-vehicle", - "type": "ListAddQuestion", - "cancel_text": "Don’t need to add any other vehicles?", - "question": { - "id": "add-question", - "type": "General", - "title": "What vehicle do you own?", - "answers": [ - { - "id": "vehicle-name", - "label": "Vehicle", - "mandatory": true, - "type": "Dropdown", - "options": [ - { - "label": "Car", - "value": "Car" - }, - { - "label": "Motorbike", - "value": "Motorbike" - }, - { - "label": "Van", - "value": "Van" - } - ] - } - ] - } - }, - "edit_block": { - "id": "edit-vehicle", - "type": "ListEditQuestion", - "cancel_text": "Don’t need to change anything?", - "question": { - "id": "edit-question", - "type": "General", - "title": "What vehicle do you own?", - "answers": [ - { - "id": "vehicle-name", - "label": "Vehicle", - "mandatory": true, - "type": "Dropdown", - "options": [ - { - "label": "Car", - "value": "Car" - }, - { - "label": "Motorbike", - "value": "Motorbike" - }, - { - "label": "Van", - "value": "Van" - } - ] - } - ] - } - }, - "remove_block": { - "id": "remove-vehicle", - "type": "ListRemoveQuestion", - "cancel_text": "Don’t need to remove this vehicle?", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this vehicle?", - "warning": "All of the information about this vehicle will be deleted", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Vehicle", - "item_title": { - "text": "{vehicle_name}", - "placeholders": [ - { - "placeholder": "vehicle_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "vehicle-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "vehicle-details-section", - "title": "Vehicle Details", - "summary": { - "show_on_completion": true - }, - "repeat": { - "for_list": "vehicles", - "title": { - "text": "{vehicle_name} details", - "placeholders": [ - { - "placeholder": "vehicle_name", - "value": { - "source": "answers", - "identifier": "vehicle-name" - } - } - ] - } - }, - "groups": [ - { - "id": "vehicle-details-group", - "blocks": [ - { - "id": "vehicle-maintenance-block", - "type": "Question", - "question": { - "id": "vehicle-maintenance-question", - "type": "General", - "title": { - "text": "What is your monthly expenditure on maintenance for your {vehicle_name}?", - "placeholders": [ - { - "placeholder": "vehicle_name", - "value": { - "source": "answers", - "identifier": "vehicle-name" - } - } - ] - }, - "answers": [ - { - "id": "vehicle-maintenance-cost", - "label": { - "text": "{vehicle_name} maintenance costs", - "placeholders": [ - { - "placeholder": "vehicle_name", - "value": { - "source": "answers", - "identifier": "vehicle-name" - } - } - ] - }, - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "id": "vehicle-fuel-block", - "type": "Question", - "question": { - "id": "vehicle-fuel-question", - "type": "General", - "title": { - "text": "What is your monthly expenditure on fuel for your {vehicle_name}?", - "placeholders": [ - { - "placeholder": "vehicle_name", - "value": { - "source": "answers", - "identifier": "vehicle-name" - } - } - ] - }, - "answers": [ - { - "id": "vehicle-fuel-cost", - "label": { - "text": "{vehicle_name} fuel costs", - "placeholders": [ - { - "placeholder": "vehicle_name", - "value": { - "source": "answers", - "identifier": "vehicle-name" - } - } - ] - }, - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-running-cost", - "title": { - "text": "We calculate the monthly running costs of your {vehicle_name} to be %(total)s. Is this correct?", - "placeholders": [ - { - "placeholder": "vehicle_name", - "value": { - "source": "answers", - "identifier": "vehicle-name" - } - } - ] - }, - "calculation": { - "title": { - "text": "Monthly {vehicle_name} costs", - "placeholders": [ - { - "placeholder": "vehicle_name", - "value": { - "source": "answers", - "identifier": "vehicle-name" - } - } - ] - }, - "operation": { - "+": [ - { - "source": "answers", - "identifier": "vehicle-maintenance-cost" - }, - { - "source": "answers", - "identifier": "vehicle-fuel-cost" - } - ] - } - } - }, - { - "type": "GrandCalculatedSummary", - "id": "grand-calculated-summary-vehicle", - "title": { - "text": "The total cost of owning and running your {vehicle_name} is calculated to be %(total)s. Is this correct?", - "placeholders": [ - { - "placeholder": "vehicle_name", - "value": { - "source": "answers", - "identifier": "vehicle-name" - } - } - ] - }, - "calculation": { - "operation": { - "+": [ - { - "source": "calculated_summary", - "identifier": "calculated-summary-base-cost" - }, - { - "source": "calculated_summary", - "identifier": "calculated-summary-running-cost" - } - ] - }, - "title": { - "text": "Grand total {vehicle_name} expenditure", - "placeholders": [ - { - "placeholder": "vehicle_name", - "value": { - "source": "answers", - "identifier": "vehicle-name" - } - } - ] - } - } - }, - { - "type": "Question", - "id": "gcs-breakdown-block", - "question": { - "id": "gcs-breakdown-question", - "guidance": { - "contents": [ - { - "description": "Currently this question is not revisited when the grand calculated summary changes. When grand calculated summary dependencies are implemented, this guidance should be removed, and this block should become incomplete upon the GCS changing." - } - ] - }, - "title": { - "text": "How do you pay for the monthly fees of {vehicle_cost}?", - "placeholders": [ - { - "placeholder": "vehicle_cost", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "identifier": "grand-calculated-summary-vehicle", - "source": "grand_calculated_summary" - } - } - } - ] - } - ] - }, - "type": "Calculated", - "warning": "These answers must add up to the total owning and running cost", - "calculations": [ - { - "calculation_type": "sum", - "value": { - "identifier": "grand-calculated-summary-vehicle", - "source": "grand_calculated_summary" - }, - "answers_to_calculate": ["pay-debit", "pay-credit", "pay-other"], - "conditions": ["equals"] - } - ], - "answers": [ - { - "id": "pay-debit", - "label": "Amount paid by debit card", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "pay-credit", - "label": "Amount paid by credit card", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "pay-other", - "label": "Amount paid by other means", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Interstitial", - "id": "gcs-piping", - "content": { - "title": { - "text": "You have provided the following information about monthly expenditure for your {vehicle_name}.", - "placeholders": [ - { - "placeholder": "vehicle_name", - "value": { - "source": "answers", - "identifier": "vehicle-name" - } - } - ] - }, - "contents": [ - { - "list": [ - { - "text": "Monthly maintenance cost: {total_maintenance}", - "placeholders": [ - { - "placeholder": "total_maintenance", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "identifier": "vehicle-maintenance-cost", - "source": "answers" - } - } - } - ] - } - ] - }, - { - "text": "Monthly fuel cost: {total_fuel}", - "placeholders": [ - { - "placeholder": "total_fuel", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "identifier": "vehicle-fuel-cost", - "source": "answers" - } - } - } - ] - } - ] - }, - { - "text": "Total base cost: {total_base}", - "placeholders": [ - { - "placeholder": "total_base", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "identifier": "calculated-summary-base-cost", - "source": "calculated_summary" - } - } - } - ] - } - ] - }, - { - "text": "Total running cost: {total_running}", - "placeholders": [ - { - "placeholder": "total_running", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "identifier": "calculated-summary-running-cost", - "source": "calculated_summary" - } - } - } - ] - } - ] - }, - { - "text": "Total owning and running cost: {total}", - "placeholders": [ - { - "placeholder": "total", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "identifier": "grand-calculated-summary-vehicle", - "source": "grand_calculated_summary" - } - } - } - ] - } - ] - }, - { - "text": "Paid by debit card: {debit}", - "placeholders": [ - { - "placeholder": "debit", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "identifier": "pay-debit", - "source": "answers" - } - } - } - ] - } - ] - }, - { - "text": "Paid by credit card: {credit}", - "placeholders": [ - { - "placeholder": "credit", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "identifier": "pay-credit", - "source": "answers" - } - } - } - ] - } - ] - }, - { - "text": "Paid by other means: {other}", - "placeholders": [ - { - "placeholder": "other", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "identifier": "pay-other", - "source": "answers" - } - } - } - ] - } - ] - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_grand_calculated_summary_overlapping_answers.json b/schemas/test/en/test_grand_calculated_summary_overlapping_answers.json deleted file mode 100644 index b21dbc9b6e..0000000000 --- a/schemas/test/en/test_grand_calculated_summary_overlapping_answers.json +++ /dev/null @@ -1,357 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Grand Calculated Summary with overlapping answers", - "theme": "default", - "description": "A schema to showcase grand calculated summaries which include multiple calculated summaries using the same answers.", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { - "required_completed_sections": ["introduction-section"] - } - }, - "sections": [ - { - "id": "introduction-section", - "title": "Introduction", - "show_on_hub": false, - "groups": [ - { - "id": "introduction-group", - "title": "Introduction", - "blocks": [ - { - "type": "Introduction", - "id": "introduction-block", - "primary_content": [ - { - "id": "about", - "contents": [ - { - "title": "About", - "list": [ - "This survey tests that when you re-use answers between calculated summaries, the grand calculated summary still resolves to the correct value" - ] - }, - { - "title": "How to test this schema", - "list": [ - "Ensure that the grand calculated summary section does not show unless all dependent calculated summaries in section-1 have been confirmed.", - "Your answer to the third question, may unlock an additional calculated summary which re-use your answers to the first two questions", - "If you do not select to buy extra food, verify no additional calculated summary occurs, and that the grand calculated summary is correct", - "If you choose to buy any food items twice, verify that they are included twice in the grand calculated summary, one for each calculated summary", - "Verify that if you have the extra calculated summary, and change the cost of bread for example using either of the calculated summary change links which include it that you are routed to each calculated summary first, and only then the grand calculated summary" - ] - } - ] - } - ] - } - ] - } - ] - }, - { - "id": "section-1", - "title": "Weekly shop", - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "id": "group-1", - "title": "Weekly shopping", - "blocks": [ - { - "type": "Question", - "id": "block-1", - "question": { - "type": "General", - "id": "question-1", - "title": "How much do you spend on the following in a typical weekly shop?", - "answers": [ - { - "id": "q1-a1", - "label": "Money on milk", - "type": "Currency", - "currency": "GBP", - "mandatory": false, - "decimal_places": 2 - }, - { - "id": "q1-a2", - "label": "Money on eggs", - "type": "Currency", - "currency": "GBP", - "mandatory": false, - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "block-2", - "question": { - "type": "General", - "id": "question-2", - "title": "How much do you spend on these items in a typical week?", - "answers": [ - { - "id": "q2-a1", - "label": "Money on bread", - "type": "Currency", - "currency": "GBP", - "mandatory": false, - "decimal_places": 2 - }, - { - "id": "q2-a2", - "label": "Money on cheese", - "type": "Currency", - "currency": "GBP", - "mandatory": false, - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-1", - "title": "Total of milk and bread is calculated to be %(total)s. Is this correct?", - "calculation": { - "title": "milk + bread", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "q1-a1" - }, - { - "source": "answers", - "identifier": "q2-a1" - } - ] - } - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-2", - "title": "Total of eggs and cheese is calculated to be %(total)s. Is this correct?", - "calculation": { - "title": "eggs + cheese", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "q1-a2" - }, - { - "source": "answers", - "identifier": "q2-a2" - } - ] - } - } - }, - { - "type": "Question", - "id": "block-3", - "question": { - "type": "General", - "id": "question-3", - "title": "Do you want to buy extra of anything this week?", - "guidance": { - "contents": [ - { - "description": "If you select the first option, all your answers so far will be reused in a new calculated summary for extra shopping. If you select the second option, only your answers for bread and cheese will be reused." - } - ] - }, - "answers": [ - { - "type": "Radio", - "id": "radio-extra", - "mandatory": true, - "options": [ - { - "label": "Yes, I am going to buy two of everything", - "value": "Yes, I am going to buy two of everything" - }, - { - "label": "Yes, extra bread and cheese", - "value": "Yes, extra bread and cheese" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "skip_conditions": { - "when": { - "!=": [ - { - "source": "answers", - "identifier": "radio-extra" - }, - "Yes, I am going to buy two of everything" - ] - } - }, - "type": "CalculatedSummary", - "id": "calculated-summary-3", - "title": "Total extra items purchased is calculated to be %(total)s. Is this correct? This reuses your answers to question 1 and 2", - "calculation": { - "title": "(extra) milk + eggs + bread + cheese", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "q1-a1" - }, - { - "source": "answers", - "identifier": "q1-a2" - }, - { - "source": "answers", - "identifier": "q2-a1" - }, - { - "source": "answers", - "identifier": "q2-a2" - } - ] - } - } - }, - { - "skip_conditions": { - "when": { - "!=": [ - { - "source": "answers", - "identifier": "radio-extra" - }, - "Yes, extra bread and cheese" - ] - } - }, - "type": "CalculatedSummary", - "id": "calculated-summary-4", - "title": "Total extra items cost is calculated to be %(total)s. Is this correct? This is reusing your bread and cheese answers", - "calculation": { - "title": "(extra) bread + cheese", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "q2-a1" - }, - { - "source": "answers", - "identifier": "q2-a2" - } - ] - } - } - } - ] - } - ] - }, - { - "id": "section-3", - "title": "Grand calculated summary", - "enabled": { - "when": { - "==": [{ "source": "progress", "selector": "section", "identifier": "section-1" }, "COMPLETED"] - } - }, - "groups": [ - { - "id": "group-2", - "title": "Grand calculated summary", - "blocks": [ - { - "type": "GrandCalculatedSummary", - "id": "grand-calculated-summary-shopping", - "title": "Grand Calculated Summary of purchases this week comes to %(total)s. Is this correct?.", - "calculation": { - "title": "Weekly shopping cost", - "operation": { - "+": [ - { - "source": "calculated_summary", - "identifier": "calculated-summary-1" - }, - { - "source": "calculated_summary", - "identifier": "calculated-summary-2" - }, - { - "source": "calculated_summary", - "identifier": "calculated-summary-3" - }, - { - "source": "calculated_summary", - "identifier": "calculated-summary-4" - } - ] - } - } - } - ] - } - ] - }, - { - "id": "section-4", - "title": "Conditional Section", - "enabled": { - "when": { - ">": [{ "source": "grand_calculated_summary", "identifier": "grand-calculated-summary-shopping" }, 500] - } - }, - "groups": [ - { - "id": "group-3", - "title": "Conditional Group", - "blocks": [ - { - "type": "Interstitial", - "id": "grand-calculated-summary-piping", - "content": { - "title": "This section is only showing because the grand calculated summary exceeded £500." - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_grand_calculated_summary_repeating_answers.json b/schemas/test/en/test_grand_calculated_summary_repeating_answers.json deleted file mode 100644 index 1938d8263c..0000000000 --- a/schemas/test/en/test_grand_calculated_summary_repeating_answers.json +++ /dev/null @@ -1,1426 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Grand Calculated Summary cross section demo", - "theme": "default", - "description": "A schema to showcase grand calculated summary across multiple sections featuring static, dynamic and list repeating block answers", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section-1", - "title": "Food and clothing", - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "id": "group-1", - "title": "Food", - "blocks": [ - { - "type": "Question", - "id": "block-1", - "question": { - "type": "General", - "id": "question-1", - "title": "How much do you spend per month on fruit and veg?", - "answers": [ - { - "id": "q1-a1", - "label": "Money spent on fruit", - "type": "Currency", - "currency": "GBP", - "mandatory": false, - "decimal_places": 2 - }, - { - "id": "q1-a2", - "label": "Money spent on veg", - "type": "Currency", - "currency": "GBP", - "mandatory": false, - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "block-2", - "question": { - "type": "General", - "id": "question-2", - "title": "How much do you spend per month on other food?", - "answers": [ - { - "id": "q2-a1", - "label": "Money spent on bread", - "type": "Currency", - "currency": "GBP", - "mandatory": false, - "decimal_places": 2 - }, - { - "id": "q2-a2", - "label": "Money spent on not bread", - "type": "Currency", - "currency": "GBP", - "mandatory": false, - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-1", - "title": "Calculated Summary for food expenditure is calculated to be %(total)s. Is this correct?", - "calculation": { - "title": "Total monthly food expenditure", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "q1-a1" - }, - { - "source": "answers", - "identifier": "q1-a2" - }, - { - "source": "answers", - "identifier": "q2-a1" - }, - { - "source": "answers", - "identifier": "q2-a2" - } - ] - } - } - } - ] - }, - { - "id": "group-2", - "title": "Clothing", - "blocks": [ - { - "type": "Question", - "id": "block-3", - "question": { - "type": "General", - "id": "question-3", - "title": "How much do you spend per month on clothes?", - "answers": [ - { - "id": "q3-a1", - "label": "Money spent on jumpers", - "type": "Currency", - "currency": "GBP", - "mandatory": false, - "decimal_places": 2 - }, - { - "id": "q3-a2", - "label": "Money spent on hats", - "type": "Currency", - "currency": "GBP", - "mandatory": false, - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-2", - "title": "Calculated summary for clothes expenditure is calculated to be %(total)s. Is this correct?", - "calculation": { - "title": "Total monthly clothes expenditure", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "q3-a1" - }, - { - "source": "answers", - "identifier": "q3-a2" - } - ] - } - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-3", - "title": "Calculated summary for food and clothing is calculated to be %(total)s. Is this correct?", - "calculation": { - "title": "Total food and clothes expenditure", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "q1-a1" - }, - { - "source": "answers", - "identifier": "q1-a2" - }, - { - "source": "answers", - "identifier": "q2-a1" - }, - { - "source": "answers", - "identifier": "q2-a2" - }, - { - "source": "answers", - "identifier": "q3-a1" - }, - { - "source": "answers", - "identifier": "q3-a2" - } - ] - } - } - }, - { - "type": "GrandCalculatedSummary", - "id": "grand-calculated-summary-1", - "title": "Grand Calculated Summary which should match the previous calculated summary is calculated to be %(total)s. Is this correct?", - "calculation": { - "title": "Grand calculated summary", - "operation": { - "+": [ - { - "source": "calculated_summary", - "identifier": "calculated-summary-1" - }, - { - "source": "calculated_summary", - "identifier": "calculated-summary-2" - } - ] - } - } - } - ] - } - ] - }, - { - "id": "section-2", - "title": "Entertainment", - "groups": [ - { - "id": "group-3", - "title": "Group title for questions about games", - "blocks": [ - { - "type": "Question", - "id": "block-4", - "question": { - "type": "General", - "id": "question-4", - "title": "How much do you spend per week on games?", - "guidance": { - "contents": [ - { - "description": "Note:" - }, - { - "list": [ - "The grand calculated summary section after this will only show if the total spending on games is not zero", - "You should test that if you use the change links on the grand calculated summary to come back here and set both answers to 0, that you are not routed to the grand calculated summary when you press continue on the calculated summary, but instead, taken to the Hub.", - "If you use the change links on the grand calculated summary to edit these answer values to a non-zero sum, pressing continue twice should take you back to the grand calculated summary" - ] - } - ] - }, - "answers": [ - { - "id": "q4-a1", - "label": "Video games", - "type": "Currency", - "currency": "GBP", - "mandatory": false, - "decimal_places": 2 - }, - { - "id": "q4-a2", - "label": "Board games", - "type": "Currency", - "currency": "GBP", - "mandatory": false, - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-4", - "title": "Calculated Summary for games expenditure is calculated to be %(total)s. Is this correct?", - "calculation": { - "title": "Total games expenditure", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "q4-a1" - }, - { - "source": "answers", - "identifier": "q4-a2" - } - ] - } - } - } - ] - } - ] - }, - { - "id": "section-3", - "title": "Grand calculated summary of shopping and entertainment", - "enabled": { - "when": { - "and": [ - { - "!=": [ - 0, - { - "source": "calculated_summary", - "identifier": "calculated-summary-4" - } - ] - }, - { - "==": [ - "COMPLETED", - { - "source": "progress", - "selector": "section", - "identifier": "section-1" - } - ] - }, - { - "==": [ - "COMPLETED", - { - "source": "progress", - "selector": "section", - "identifier": "section-2" - } - ] - } - ] - } - }, - "groups": [ - { - "id": "group-4", - "title": "Group title for the grand calculated summary of both sections", - "blocks": [ - { - "type": "GrandCalculatedSummary", - "id": "grand-calculated-summary-2", - "title": "Grand Calculated Summary for shopping and entertainment is calculated to be %(total)s. Is this correct?", - "calculation": { - "title": "Total food clothes and games expenditure", - "operation": { - "+": [ - { - "source": "calculated_summary", - "identifier": "calculated-summary-1" - }, - { - "source": "calculated_summary", - "identifier": "calculated-summary-2" - }, - { - "source": "calculated_summary", - "identifier": "calculated-summary-4" - } - ] - } - } - } - ] - } - ] - }, - { - "id": "section-4", - "title": "Utility bills", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "utility-bills", - "title": "Utility bills", - "item_anchor_answer_id": "utility-bill-name", - "item_label": "Utility bill", - "add_link_text": "Add another utility bill", - "empty_list_text": "No utility bills added" - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "group-5", - "title": "Utility bills", - "blocks": [ - { - "type": "ListCollectorDrivingQuestion", - "id": "any-utility-bills", - "for_list": "utility-bills", - "question": { - "type": "General", - "id": "any-utility-bills-question", - "title": "Do you have any monthly expenditure on Utility bills?", - "answers": [ - { - "type": "Radio", - "id": "any-utility-bills-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-utility-bill", - "list_name": "utility-bills" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "when": { - "==": [ - { - "source": "answers", - "identifier": "any-utility-bills-answer" - }, - "Yes" - ] - }, - "block": "any-other-utility-bills" - }, - { - "section": "End" - } - ] - }, - { - "id": "any-other-utility-bills", - "type": "ListCollector", - "for_list": "utility-bills", - "question": { - "id": "any-other-utility-bills-question", - "type": "General", - "title": "Do you need to add any other Utility bills?", - "answers": [ - { - "id": "any-other-utility-bills-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-utility-bill", - "type": "ListAddQuestion", - "question": { - "id": "add-utility-bill-question", - "type": "General", - "title": "What bill do you need to add expenditure for?", - "answers": [ - { - "id": "utility-bill-name", - "label": "Utility bill", - "mandatory": true, - "type": "Dropdown", - "options": [ - { - "label": "Electricity", - "value": "Electricity" - }, - { - "label": "Water", - "value": "Water" - }, - { - "label": "Gas", - "value": "Gas" - }, - { - "label": "Internet", - "value": "Internet" - } - ] - } - ] - } - }, - "edit_block": { - "id": "edit-utility-bill", - "type": "ListEditQuestion", - "question": { - "id": "edit-utility-bill-question", - "type": "General", - "title": "What is the name of the game?", - "answers": [ - { - "id": "utility-bill-name", - "label": "Name of Utility bill", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-utility-bill", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-utility-bill-question", - "type": "General", - "title": "Are you sure you want to remove this Utility bill?", - "answers": [ - { - "id": "remove-utility-bill-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Utility bills", - "item_title": { - "text": "{utility_bill}", - "placeholders": [ - { - "placeholder": "utility_bill", - "value": { - "source": "answers", - "identifier": "utility-bill-name" - } - } - ] - } - } - }, - { - "type": "Question", - "id": "dynamic-answer", - "skip_conditions": { - "when": { - "==": [ - { - "count": [ - { - "source": "list", - "identifier": "utility-bills" - } - ] - }, - 0 - ] - } - }, - "question": { - "dynamic_answers": { - "values": { - "source": "list", - "identifier": "utility-bills" - }, - "answers": [ - { - "label": { - "text": "Monthly expenditure on {utility_bill} bills", - "placeholders": [ - { - "placeholder": "utility_bill", - "value": { - "source": "answers", - "identifier": "utility-bill-name" - } - } - ] - }, - "id": "utility-bill-monthly-cost", - "type": "Currency", - "mandatory": true, - "currency": "GBP", - "decimal_places": 2 - } - ] - }, - "id": "dynamic-answer-question", - "title": "Monthly expenditure on utility bills", - "type": "General" - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-5", - "title": "Calculated Summary for monthly spending on utility bills is calculated to be %(total)s. Is this correct?", - "calculation": { - "title": "Total monthly expenditure on utility bills", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "utility-bill-monthly-cost" - } - ] - } - } - } - ] - } - ] - }, - { - "id": "section-5", - "title": "Streaming services", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "streaming-services", - "title": "Streaming services", - "item_anchor_answer_id": "streaming-service-name", - "item_label": "Streaming service", - "add_link_text": "Add another streaming service", - "empty_list_text": "No streaming services added" - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "group-6", - "title": "Streaming services", - "blocks": [ - { - "type": "ListCollectorDrivingQuestion", - "id": "any-streaming-services", - "for_list": "streaming-services", - "question": { - "type": "General", - "id": "any-streaming-services-question", - "title": "Do you have any monthly expenditure on streaming services?", - "answers": [ - { - "type": "Radio", - "id": "any-streaming-services-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-streaming-service", - "list_name": "streaming-services" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "when": { - "==": [ - { - "source": "answers", - "identifier": "any-streaming-services-answer" - }, - "Yes" - ] - }, - "block": "any-other-streaming-services" - }, - { - "section": "End" - } - ] - }, - { - "id": "any-other-streaming-services", - "type": "ListCollector", - "for_list": "streaming-services", - "question": { - "id": "any-other-streaming-services-question", - "type": "General", - "title": "Do you need to add any other streaming services?", - "answers": [ - { - "id": "any-other-streaming-services-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-streaming-service", - "type": "ListAddQuestion", - "question": { - "id": "add-streaming-service-question", - "type": "General", - "title": "What is the name of the Streaming service?", - "answers": [ - { - "id": "streaming-service-name", - "label": "Name of Streaming service", - "mandatory": true, - "type": "Dropdown", - "options": [ - { - "label": "Netflix", - "value": "Netflix" - }, - { - "label": "Prime video", - "value": "Prime video" - }, - { - "label": "Now TV", - "value": "Now TV" - }, - { - "label": "Apple TV", - "value": "Apple TV" - }, - { - "label": "Disney+", - "value": "Disney+" - } - ] - } - ] - } - }, - "edit_block": { - "id": "edit-streaming-service", - "type": "ListEditQuestion", - "question": { - "id": "edit-streaming-service-question", - "type": "General", - "title": "What is the name of the Streaming service?", - "answers": [ - { - "id": "streaming-service-name", - "label": "Name of Streaming service", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-streaming-service", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-streaming-service-question", - "type": "General", - "title": "Are you sure you want to remove this Streaming service?", - "answers": [ - { - "id": "remove-streaming-service-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "repeating_blocks": [ - { - "id": "streaming-service-repeating-block-1", - "type": "ListRepeatingQuestion", - "question": { - "id": "streaming-service-repeating-block-1-question", - "type": "General", - "title": { - "text": "What is your monthly expenditure on {streaming_service} bills?", - "placeholders": [ - { - "placeholder": "streaming_service", - "value": { - "source": "answers", - "identifier": "streaming-service-name" - } - } - ] - }, - "answers": [ - { - "id": "streaming-service-monthly-cost", - "label": { - "text": "Monthly subscription cost for {streaming_service}", - "placeholders": [ - { - "placeholder": "streaming_service", - "value": { - "source": "answers", - "identifier": "streaming-service-name" - } - } - ] - }, - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "streaming-service-extra-cost", - "label": { - "text": "Additional monthly spending on {streaming_service}", - "placeholders": [ - { - "placeholder": "streaming_service", - "value": { - "source": "answers", - "identifier": "streaming-service-name" - } - } - ] - }, - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "id": "streaming-service-repeating-block-2", - "type": "ListRepeatingQuestion", - "question": { - "id": "streaming-service-repeating-block-2-question", - "type": "General", - "title": { - "text": "What is your average monthly internet usage for {streaming_service}?", - "placeholders": [ - { - "placeholder": "streaming_service", - "value": { - "source": "answers", - "identifier": "streaming-service-name" - } - } - ] - }, - "answers": [ - { - "id": "streaming-service-usage", - "label": { - "text": "Monthly Internet usage for {streaming_service}", - "placeholders": [ - { - "placeholder": "streaming_service", - "value": { - "source": "answers", - "identifier": "streaming-service-name" - } - } - ] - }, - "mandatory": true, - "type": "Unit", - "unit_length": "short", - "unit": "digital-gigabyte", - "decimal_places": 2 - } - ] - } - } - ], - "summary": { - "title": "Streaming services", - "item_title": { - "text": "{streaming_service_name}", - "placeholders": [ - { - "placeholder": "streaming_service_name", - "value": { - "source": "answers", - "identifier": "streaming-service-name" - } - } - ] - } - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-6", - "title": "Calculated Summary for monthly expenditure on streaming services is calculated to be %(total)s. Is this correct?", - "calculation": { - "title": "Total monthly expenditure on streaming services", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "streaming-service-monthly-cost" - }, - { - "source": "answers", - "identifier": "streaming-service-extra-cost" - } - ] - } - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-7", - "title": "Total monthly internet usage on streaming services is calculated to be %(total)s. Is this correct?", - "calculation": { - "title": "Total internet usage on streaming services", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "streaming-service-usage" - } - ] - } - } - }, - { - "type": "Question", - "id": "other-internet-usage", - "question": { - "type": "General", - "id": "other-internet-question", - "title": "Do you have any additional internet usage to report?", - "answers": [ - { - "id": "media-downloads", - "label": "Internet usage on media downloads", - "mandatory": false, - "type": "Unit", - "unit_length": "short", - "unit": "digital-gigabyte", - "decimal_places": 2 - }, - { - "id": "misc-internet", - "label": "Other miscellaneous internet usage", - "mandatory": false, - "type": "Unit", - "unit_length": "short", - "unit": "digital-gigabyte", - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-8", - "title": "Total monthly internet usage on other services is calculated to be %(total)s. Is this correct?", - "calculation": { - "title": "Total internet usage on other services", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "media-downloads" - }, - { - "source": "answers", - "identifier": "misc-internet" - } - ] - } - } - } - ] - } - ] - }, - { - "id": "section-6", - "title": "Grand calculated summary of household expenditure", - "enabled": { - "when": { - "and": [ - { - "==": [ - "COMPLETED", - { - "source": "progress", - "selector": "section", - "identifier": "section-1" - } - ] - }, - { - "==": [ - "COMPLETED", - { - "source": "progress", - "selector": "section", - "identifier": "section-2" - } - ] - }, - { - "==": [ - "COMPLETED", - { - "source": "progress", - "selector": "section", - "identifier": "section-4" - } - ] - }, - { - "==": [ - "COMPLETED", - { - "source": "progress", - "selector": "section", - "identifier": "section-5" - } - ] - } - ] - } - }, - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "id": "group-7", - "title": "Expenditure grand totals", - "blocks": [ - { - "type": "GrandCalculatedSummary", - "id": "grand-calculated-summary-3", - "title": "Grand Calculated Summary for monthly spending on bills and services is calculated to be %(total)s. Is this correct?", - "calculation": { - "title": "Total monthly expenditure on bills and streaming services", - "operation": { - "+": [ - { - "source": "calculated_summary", - "identifier": "calculated-summary-5" - }, - { - "source": "calculated_summary", - "identifier": "calculated-summary-6" - } - ] - } - } - }, - { - "type": "GrandCalculatedSummary", - "id": "grand-calculated-summary-4", - "title": "Grand Calculated Summary for internet usage is calculated to be %(total)s. Is this correct?", - "calculation": { - "title": "Total internet usage", - "operation": { - "+": [ - { - "source": "calculated_summary", - "identifier": "calculated-summary-7" - }, - { - "source": "calculated_summary", - "identifier": "calculated-summary-8" - } - ] - } - } - }, - { - "type": "GrandCalculatedSummary", - "id": "grand-calculated-summary-5", - "title": "Grand Calculated Summary for total monthly household expenditure is calculated to be %(total)s. Is this correct?", - "calculation": { - "title": "Total monthly expenditure", - "operation": { - "+": [ - { - "source": "calculated_summary", - "identifier": "calculated-summary-1" - }, - { - "source": "calculated_summary", - "identifier": "calculated-summary-2" - }, - { - "source": "calculated_summary", - "identifier": "calculated-summary-4" - }, - { - "source": "calculated_summary", - "identifier": "calculated-summary-5" - }, - { - "source": "calculated_summary", - "identifier": "calculated-summary-6" - } - ] - } - } - }, - { - "type": "Question", - "id": "internet-breakdown-block", - "question": { - "id": "internet-breakdown-question", - "title": { - "text": "How did you use the {internet_usage} across your devices?", - "placeholders": [ - { - "placeholder": "internet_usage", - "transforms": [ - { - "transform": "format_unit", - "arguments": { - "value": { - "source": "grand_calculated_summary", - "identifier": "grand-calculated-summary-4" - }, - "unit": "digital-gigabyte", - "unit_length": "short" - } - } - ] - } - ] - }, - "type": "Calculated", - "warning": "These answers must add up to the total internet usage", - "calculations": [ - { - "calculation_type": "sum", - "value": { - "identifier": "grand-calculated-summary-4", - "source": "grand_calculated_summary" - }, - "answers_to_calculate": ["internet-pc", "internet-phone"], - "conditions": ["equals"] - } - ], - "answers": [ - { - "id": "internet-pc", - "label": "Amount of internet usage via PC", - "mandatory": true, - "type": "Unit", - "unit_length": "short", - "unit": "digital-gigabyte", - "decimal_places": 2 - }, - { - "id": "internet-phone", - "label": "Amount of internet usage via Phone", - "mandatory": true, - "type": "Unit", - "unit_length": "short", - "unit": "digital-gigabyte", - "decimal_places": 2 - } - ] - } - } - ] - } - ] - }, - { - "id": "section-7", - "title": "Personal Expenditure", - "enabled": { - "when": { - "==": [ - "COMPLETED", - { - "source": "progress", - "selector": "section", - "identifier": "section-6" - } - ] - } - }, - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "id": "group-8", - "blocks": [ - { - "type": "Question", - "id": "personal-expenditure-block", - "question": { - "id": "personal-expenditure-question", - "title": { - "text": "How much of the {total_expenditure} household expenditure do you contribute personally?", - "placeholders": [ - { - "placeholder": "total_expenditure", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "identifier": "grand-calculated-summary-5", - "source": "grand_calculated_summary" - } - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "personal-expenditure-answer", - "label": "Personal contribution", - "mandatory": true, - "description": "Cannot exceed the total expenditure from section 6", - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "maximum": { - "value": { - "identifier": "grand-calculated-summary-5", - "source": "grand_calculated_summary" - } - } - } - ] - } - }, - { - "type": "Interstitial", - "id": "grand-calculated-summary-piping", - "content": { - "title": "You have provided the following information about household expenditure and internet use.", - "contents": [ - { - "list": [ - { - "text": "Total household expenditure: {total_expenditure}", - "placeholders": [ - { - "placeholder": "total_expenditure", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "identifier": "grand-calculated-summary-5", - "source": "grand_calculated_summary" - } - } - } - ] - } - ] - }, - { - "text": "Personal contribution: {personal_contribution}", - "placeholders": [ - { - "placeholder": "personal_contribution", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "identifier": "personal-expenditure-answer", - "source": "answers" - } - } - } - ] - } - ] - }, - { - "text": "Total internet usage: {internet_usage}", - "placeholders": [ - { - "placeholder": "internet_usage", - "transforms": [ - { - "transform": "format_unit", - "arguments": { - "value": { - "source": "grand_calculated_summary", - "identifier": "grand-calculated-summary-4" - }, - "unit": "digital-gigabyte", - "unit_length": "short" - } - } - ] - } - ] - }, - { - "text": "Usage by phone: {internet_phone}", - "placeholders": [ - { - "placeholder": "internet_phone", - "transforms": [ - { - "transform": "format_unit", - "arguments": { - "value": { - "source": "answers", - "identifier": "internet-phone" - }, - "unit": "digital-gigabyte", - "unit_length": "short" - } - } - ] - } - ] - }, - { - "text": "Usage by PC: {internet_pc}", - "placeholders": [ - { - "placeholder": "internet_pc", - "transforms": [ - { - "transform": "format_unit", - "arguments": { - "value": { - "source": "answers", - "identifier": "internet-pc" - }, - "unit": "digital-gigabyte", - "unit_length": "short" - } - } - ] - } - ] - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_hub_and_spoke.json b/schemas/test/en/test_hub_and_spoke.json deleted file mode 100644 index 7535553170..0000000000 --- a/schemas/test/en/test_hub_and_spoke.json +++ /dev/null @@ -1,319 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Hub & Spoke", - "theme": "default", - "description": "A questionnaire to demo hub and spoke functionality", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "employment-section", - "title": "Employment", - "groups": [ - { - "id": "radio", - "title": "Radio Optional", - "blocks": [ - { - "type": "Question", - "id": "employment-status", - "question": { - "answers": [ - { - "id": "employment-status-answer", - "mandatory": false, - "options": [ - { - "label": "Working as an employee", - "value": "Working as an employee" - }, - { - "label": "Self-employed or freelance", - "value": "Self-employed or freelance" - }, - { - "label": "Temporarily away from work ill, on holiday or temporarily laid off", - "value": "Temporarily away from work ill, on holiday or temporarily laid off" - }, - { - "label": "On maternity or paternity leave", - "value": "On maternity or paternity leave" - }, - { - "label": "Doing any other kind of paid work", - "value": "Doing any other kind of paid work" - } - ], - "type": "Checkbox" - }, - { - "id": "employment-status-answer-exclusive", - "mandatory": false, - "options": [ - { - "label": "None of these apply", - "value": "None of these apply" - } - ], - "type": "Checkbox" - } - ], - "guidance": { - "contents": [ - { - "description": "Include casual or temporary work, even if only for one hour" - } - ] - }, - "id": "employment-status-question", - "mandatory": true, - "title": "In the last seven days, were you doing any of the following?", - "type": "MutuallyExclusive" - }, - "routing_rules": [ - { - "group": "checkboxes", - "when": { - "!=": [ - { - "identifier": "employment-status-answer", - "source": "answers" - }, - null - ] - } - }, - { - "block": "employment-type" - } - ] - }, - { - "type": "Question", - "id": "employment-type", - "question": { - "answers": [ - { - "id": "employment-type-answer", - "mandatory": false, - "options": [ - { - "description": "Whether receiving a pension or not", - "label": "Retired", - "value": "Retired" - }, - { - "label": "Studying", - "value": "Studying" - }, - { - "label": "Looking after home or family", - "value": "Looking after home or family" - }, - { - "label": "Long-term sick or disabled", - "value": "Long-term sick or disabled" - }, - { - "label": "Other", - "value": "Other" - } - ], - "type": "Checkbox" - } - ], - "id": "employment-type-question", - "title": "Which of the following describes what you were doing in the last seven days?", - "type": "General" - } - } - ] - } - ] - }, - { - "id": "accommodation-section", - "title": "Accommodation", - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "blocks": [ - { - "id": "proxy", - "question": { - "answers": [ - { - "default": "Yes", - "id": "proxy-answer", - "mandatory": false, - "options": [ - { - "label": "No, I’m answering for myself", - "value": "No, I’m answering for myself" - }, - { - "label": "Yes", - "value": "Yes" - } - ], - "type": "Radio" - } - ], - "id": "proxy-question", - "title": "Are you answering the questions on behalf of someone else?", - "type": "General" - }, - "type": "Question" - } - ], - "id": "checkboxes" - } - ] - }, - { - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "blocks": [ - { - "id": "does-anyone-live-here", - "question": { - "answers": [ - { - "id": "does-anyone-live-here-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "does-anyone-live-here-question", - "title": "Does anyone live here?", - "type": "General" - }, - "type": "Question" - }, - { - "id": "how-many-people-live-here", - "question": { - "answers": [ - { - "id": "how-many-people-live-here-answer", - "mandatory": true, - "options": [ - { - "label": "1", - "value": "1" - }, - { - "label": "2", - "value": "2" - }, - { - "label": "3+", - "value": "3+" - } - ], - "type": "Radio" - } - ], - "id": "how-many-people-live-here-question", - "title": "How many people live here?", - "type": "General" - }, - "type": "Question", - "skip_conditions": { - "when": { - "==": [ - { - "source": "answers", - "identifier": "does-anyone-live-here-answer" - }, - "No" - ] - } - } - } - ], - "id": "household-question-group", - "title": "Household residents" - } - ], - "id": "household-section", - "title": "Household residents" - }, - { - "id": "relationships-section", - "title": "Relationships", - "show_on_hub": false, - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "blocks": [ - { - "id": "anyone-related", - "question": { - "answers": [ - { - "id": "anyone-related-answer", - "mandatory": false, - "options": [ - { - "label": "No", - "value": "No" - }, - { - "label": "Yes", - "value": "Yes" - } - ], - "type": "Radio" - } - ], - "id": "anyone-related-question", - "title": "Are any of the people living here related?", - "type": "General" - }, - "type": "Question" - } - ], - "id": "relationship-group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_hub_and_spoke_custom_content.json b/schemas/test/en/test_hub_and_spoke_custom_content.json deleted file mode 100644 index b951e23cba..0000000000 --- a/schemas/test/en/test_hub_and_spoke_custom_content.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Hub & Spoke", - "theme": "default", - "description": "A questionnaire to demo hub and spoke custom content functionality", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "submission": { - "button": "Submission button", - "guidance": "Submission guidance", - "title": "Submission title", - "warning": "Submission warning" - }, - "sections": [ - { - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "blocks": [ - { - "id": "does-anyone-live-here", - "question": { - "answers": [ - { - "id": "does-anyone-live-here-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "does-anyone-live-here-question", - "title": "Does anyone live here?", - "type": "General" - }, - "type": "Question" - }, - { - "id": "how-many-people-live-here", - "question": { - "answers": [ - { - "id": "how-many-people-live-here-answer", - "mandatory": true, - "options": [ - { - "label": "1", - "value": "1" - }, - { - "label": "2", - "value": "2" - }, - { - "label": "3+", - "value": "3+" - } - ], - "type": "Radio" - } - ], - "id": "how-many-people-live-here-question", - "title": "How many people live here?", - "type": "General" - }, - "type": "Question", - "skip_conditions": { - "when": { - "==": [ - { - "source": "answers", - "identifier": "does-anyone-live-here-answer" - }, - "No" - ] - } - } - } - ], - "id": "household-question-group", - "title": "Household residents" - } - ], - "id": "household-section", - "title": "Household residents" - } - ] -} diff --git a/schemas/test/en/test_hub_complete_sections.json b/schemas/test/en/test_hub_complete_sections.json deleted file mode 100644 index e0691427e9..0000000000 --- a/schemas/test/en/test_hub_complete_sections.json +++ /dev/null @@ -1,198 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Hub & Spoke", - "theme": "default", - "description": "A questionnaire to demo hub and spoke functionality", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { - "required_completed_sections": ["employment-section"] - } - }, - "sections": [ - { - "id": "employment-section", - "title": "Employment", - "groups": [ - { - "id": "radio", - "title": "Radio Optional", - "blocks": [ - { - "type": "Question", - "id": "employment-status", - "question": { - "answers": [ - { - "id": "employment-status-answer", - "mandatory": false, - "options": [ - { - "label": "Working as an employee", - "value": "Working as an employee" - }, - { - "label": "Self-employed or freelance", - "value": "Self-employed or freelance" - }, - { - "label": "Temporarily away from work ill, on holiday or temporarily laid off", - "value": "Temporarily away from work ill, on holiday or temporarily laid off" - }, - { - "label": "On maternity or paternity leave", - "value": "On maternity or paternity leave" - }, - { - "label": "Doing any other kind of paid work", - "value": "Doing any other kind of paid work" - } - ], - "type": "Checkbox" - }, - { - "id": "employment-status-answer-exclusive", - "mandatory": false, - "options": [ - { - "label": "None of these apply", - "value": "None of these apply" - } - ], - "type": "Checkbox" - } - ], - "guidance": { - "contents": [ - { - "description": "Include casual or temporary work, even if only for one hour" - } - ] - }, - "id": "employment-status-question", - "mandatory": true, - "title": "In the last seven days, were you doing any of the following?", - "type": "MutuallyExclusive" - }, - "routing_rules": [ - { - "group": "checkboxes", - "when": { - "!=": [ - { - "identifier": "employment-status-answer", - "source": "answers" - }, - null - ] - } - }, - { - "block": "employment-type" - } - ] - }, - { - "type": "Question", - "id": "employment-type", - "question": { - "answers": [ - { - "id": "employment-type-answer", - "mandatory": false, - "options": [ - { - "description": "Whether receiving a pension or not", - "label": "Retired", - "value": "Retired" - }, - { - "label": "Studying", - "value": "Studying" - }, - { - "label": "Looking after home or family", - "value": "Looking after home or family" - }, - { - "label": "Long-term sick or disabled", - "value": "Long-term sick or disabled" - }, - { - "label": "Other", - "value": "Other" - } - ], - "type": "Checkbox" - } - ], - "id": "employment-type-question", - "title": "Which of the following describes what you were doing in the last seven days?", - "type": "General" - } - } - ] - } - ] - }, - { - "id": "accommodation-section", - "title": "Accommodation", - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "blocks": [ - { - "id": "proxy", - "question": { - "answers": [ - { - "default": "Yes", - "id": "proxy-answer", - "mandatory": false, - "options": [ - { - "label": "No, I’m answering for myself", - "value": "No, I’m answering for myself" - }, - { - "label": "Yes", - "value": "Yes" - } - ], - "type": "Radio" - } - ], - "id": "proxy-question", - "title": "Are you answering the questions on behalf of someone else?", - "type": "General" - }, - "type": "Question" - } - ], - "id": "checkboxes" - } - ] - } - ] -} diff --git a/schemas/test/en/test_hub_section_required_and_enabled.json b/schemas/test/en/test_hub_section_required_and_enabled.json deleted file mode 100644 index 6320062ce6..0000000000 --- a/schemas/test/en/test_hub_section_required_and_enabled.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Hub & Spoke required and enabled sections", - "theme": "default", - "description": "A questionnaire to demo hub and spoke required and enabled sections", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { "required_completed_sections": ["household-section", "relationships-section"] } - }, - "sections": [ - { - "id": "household-section", - "title": "Household", - "groups": [ - { - "id": "radio", - "title": "Household Relationships", - "blocks": [ - { - "type": "Question", - "id": "household-relationships-block", - "question": { - "type": "General", - "id": "household-relationships-question", - "title": "Is anyone related in this household?", - "answers": [ - { - "type": "Radio", - "id": "household-relationships-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "relationships-section", - "title": "Relationships", - "show_on_hub": false, - "groups": [ - { - "blocks": [ - { - "id": "relationships-count", - "question": { - "type": "General", - "id": "relationships-count-question", - "title": "How many people are related?", - "answers": [ - { - "type": "Radio", - "id": "relationships-count-answer", - "mandatory": true, - "options": [ - { - "label": "1", - "value": "1" - }, - { - "label": "2", - "value": "2" - }, - { - "label": "3+", - "value": "3+" - } - ] - } - ] - }, - "type": "Question" - } - ], - "id": "relationships-count-group", - "title": "Relationships count" - } - ], - "enabled": { - "when": { - "==": [ - "Yes", - { - "source": "answers", - "identifier": "household-relationships-answer" - } - ] - } - } - } - ] -} diff --git a/schemas/test/en/test_hub_section_required_with_repeat.json b/schemas/test/en/test_hub_section_required_with_repeat.json deleted file mode 100644 index aaff2a9ed3..0000000000 --- a/schemas/test/en/test_hub_section_required_with_repeat.json +++ /dev/null @@ -1,431 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Hub & Spoke Enabled with Required Repeating Sections", - "theme": "default", - "description": "A questionnaire to demo hub and spoke functionality with required repeating sections", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { - "required_completed_sections": ["list-collector-section", "personal-details-section"] - } - }, - "sections": [ - { - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": "Household members", - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ] - }, - "id": "list-collector-section", - "title": "Household", - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "primary-person-list-collector", - "type": "PrimaryPersonListCollector", - "for_list": "people", - "add_or_edit_block": { - "id": "add-or-edit-primary-person", - "type": "PrimaryPersonListAddOrEditQuestion", - "question": { - "id": "primary-person-add-or-edit-question", - "type": "General", - "title": "What is your name?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "question": { - "id": "primary-confirmation-question", - "type": "General", - "title": "Do you live here?", - "answers": [ - { - "id": "you-live-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "personal-details-section", - "title": "Personal Details", - "summary": { - "show_on_completion": true - }, - "repeat": { - "for_list": "people", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "groups": [ - { - "id": "personal-details-group", - "title": "Personal Details", - "blocks": [ - { - "id": "proxy", - "question": { - "answers": [ - { - "default": "Yes", - "id": "proxy-answer", - "mandatory": false, - "options": [ - { - "label": "No, I’m answering for myself", - "value": "No, I’m answering for myself" - }, - { - "label": "Yes", - "value": "Yes" - } - ], - "type": "Radio" - } - ], - "id": "proxy-question", - "title": "Are you answering the questions on behalf of someone else?", - "type": "General" - }, - "type": "Question" - }, - { - "id": "date-of-birth", - "question_variants": [ - { - "question": { - "answers": [ - { - "id": "date-of-birth-answer", - "mandatory": true, - "maximum": { - "value": "now" - }, - "minimum": { - "offset_by": { - "years": -115 - }, - "value": "2019-10-13" - }, - "type": "Date" - } - ], - "guidance": { - "contents": [ - { - "description": "For example 31 12 1970" - } - ] - }, - "id": "date-of-birth-question", - "title": "What is your date of birth?", - "type": "General" - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "proxy-answer" - }, - "No, I’m answering for myself" - ] - } - }, - { - "question": { - "answers": [ - { - "id": "date-of-birth-answer", - "mandatory": true, - "maximum": { - "value": "now" - }, - "minimum": { - "offset_by": { - "years": -115 - }, - "value": "2019-10-13" - }, - "type": "Date" - } - ], - "guidance": { - "contents": [ - { - "description": "For example 31 12 1970" - } - ] - }, - "id": "date-of-birth-question", - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "What is {person_name_possessive} date of birth?" - }, - "type": "General" - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "proxy-answer" - }, - "Yes" - ] - } - } - ], - "type": "Question" - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_hub_section_required_with_repeat_supplementary.json b/schemas/test/en/test_hub_section_required_with_repeat_supplementary.json deleted file mode 100644 index a61369a87a..0000000000 --- a/schemas/test/en/test_hub_section_required_with_repeat_supplementary.json +++ /dev/null @@ -1,414 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "123", - "title": "Test Hub Enabled with Repeats Using Supplementary Data", - "theme": "default", - "description": "A questionnaire to demo the Hub enabled when repeating sections using Supplementary data are complete.", - "metadata": [ - { - "name": "survey_id", - "type": "string" - }, - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "sds_dataset_id", - "type": "string" - } - ], - "supplementary_data": { - "lists": ["employees"] - }, - "questionnaire_flow": { - "type": "Hub", - "options": { - "required_completed_sections": ["introduction-section", "section-2", "section-3"] - } - }, - "post_submission": { - "view_response": true - }, - "sections": [ - { - "id": "introduction-section", - "title": "Introduction", - "groups": [ - { - "id": "introduction-group", - "title": "Introduction Group", - "blocks": [ - { - "id": "loaded-successfully-block", - "type": "Interstitial", - "content": { - "title": "Supplementary Data", - "contents": [ - { - "title": "You have successfully loaded Supplementary data", - "description": "Press continue to proceed to the introduction", - "guidance": { - "contents": [ - { - "description": "The purpose of this block, is to test that supplementary data loads successfully, separate to using the supplementary data" - } - ] - } - } - ] - } - }, - { - "id": "introduction-block", - "type": "Introduction", - "primary_content": [ - { - "id": "business-details", - "title": { - "text": "You are completing this survey for {company_name}", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "supplementary_data", - "identifier": "company_name" - } - } - ] - }, - "contents": [ - { - "description": { - "text": "If the company details or structure have changed contact us on {telephone_number_link}", - "placeholders": [ - { - "placeholder": "telephone_number_link", - "value": { - "source": "supplementary_data", - "identifier": "company_details", - "selectors": ["telephone_number"] - } - } - ] - } - }, - { - "guidance": { - "contents": [ - { - "title": "Guidance for completing this survey", - "list": [ - "The company name, telephone number all come from supplementary data", - "if you picked the supplementary dataset with guidance, there will be a 3rd bullet point below this one, with the supplementary guidance.", - { - "text": "{survey_guidance}", - "placeholders": [ - { - "placeholder": "survey_guidance", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "supplementary_data", - "identifier": "guidance" - } - ] - } - } - ] - } - ] - } - ] - } - ] - } - } - ] - } - ] - } - ] - } - ] - }, - { - "id": "section-2", - "title": "Employees", - "groups": [ - { - "id": "employee-reporting", - "blocks": [ - { - "id": "list-collector-employees", - "type": "ListCollectorContent", - "page_title": "Employees", - "for_list": "employees", - "content": { - "title": "Employees", - "contents": [ - { - "definition": { - "title": "Company employees", - "contents": [ - { - "description": "List of previously reported employees." - } - ] - } - }, - { - "description": "You have previously reported on the above employees. Press continue to proceed to the next section where you can add any additional employees." - } - ] - }, - "summary": { - "title": "employees", - "item_title": { - "text": "{employee_name}", - "placeholders": [ - { - "placeholder": "employee_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "supplementary_data", - "identifier": "employees", - "selectors": ["personal_details", "forename"] - }, - { - "source": "supplementary_data", - "identifier": "employees", - "selectors": ["personal_details", "surname"] - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "section-3", - "title": "Employee Details", - "summary": { - "show_on_completion": true - }, - "repeat": { - "for_list": "employees", - "title": { - "text": "{employee_name}", - "placeholders": [ - { - "placeholder": "employee_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "supplementary_data", - "identifier": "employees", - "selectors": ["personal_details", "forename"] - }, - { - "source": "supplementary_data", - "identifier": "employees", - "selectors": ["personal_details", "surname"] - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - }, - "groups": [ - { - "id": "employee-detail-questions", - "blocks": [ - { - "type": "Question", - "id": "length-of-employment", - "question": { - "id": "length-employment-question", - "type": "General", - "title": { - "text": "When did {employee_name} start working for {company_name}?", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "supplementary_data", - "identifier": "company_name" - } - }, - { - "placeholder": "employee_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "supplementary_data", - "identifier": "employees", - "selectors": ["personal_details", "forename"] - }, - { - "source": "supplementary_data", - "identifier": "employees", - "selectors": ["personal_details", "surname"] - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - }, - "answers": [ - { - "id": "employment-start", - "label": { - "text": "Start date at {company_name}", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "supplementary_data", - "identifier": "company_name" - } - } - ] - }, - "mandatory": true, - "type": "Date", - "maximum": { - "value": "now" - }, - "minimum": { - "value": { - "source": "supplementary_data", - "identifier": "incorporation_date" - } - } - } - ] - } - }, - { - "id": "conditional-employee-block", - "type": "Question", - "skip_conditions": { - "when": { - "!=": [ - { - "count": [ - { - "source": "list", - "identifier": "employees" - } - ] - }, - 3 - ] - } - }, - "question": { - "id": "conditional-employee-question", - "guidance": { - "contents": [ - { - "description": "This block is enabled because there are 3 employees in the supplementary dataset" - } - ] - }, - "type": "General", - "title": { - "text": "Has {employee_name} been promoted since starting at {company_name}?", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "supplementary_data", - "identifier": "company_name" - } - }, - { - "placeholder": "employee_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "supplementary_data", - "identifier": "employees", - "selectors": ["personal_details", "forename"] - }, - { - "source": "supplementary_data", - "identifier": "employees", - "selectors": ["personal_details", "surname"] - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - }, - "answers": [ - { - "id": "promoted-yes-no-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_individual_response.json b/schemas/test/en/test_individual_response.json deleted file mode 100644 index 447c3b0915..0000000000 --- a/schemas/test/en/test_individual_response.json +++ /dev/null @@ -1,626 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "census", - "title": "Test Individual Response", - "theme": "default", - "description": "A questionnaire to test individual response", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "display_address", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { "required_completed_sections": ["section"] } - }, - "individual_response": { - "for_list": "household", - "individual_section_id": "individual-section" - }, - "sections": [ - { - "id": "section", - "title": "People who live here", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "household", - "title": { - "text": "Household members staying overnight on {census_date}", - "placeholders": [ - { - "placeholder": "census_date", - "transforms": [ - { - "arguments": { - "date_format": "d MMMM yyyy", - "date_to_format": { - "value": "2019-10-13" - } - }, - "transform": "format_date" - } - ] - } - ] - }, - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "Questions", - "blocks": [ - { - "id": "primary-person-list-collector", - "type": "PrimaryPersonListCollector", - "for_list": "household", - "same_name_answer_ids": ["first-name", "last-name"], - "add_or_edit_block": { - "id": "add-or-edit-primary-person", - "type": "PrimaryPersonListAddOrEditQuestion", - "question": { - "id": "primary-person-add-or-edit-question", - "type": "General", - "title": "What is your name?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "middle-names", - "label": "Middle names", - "mandatory": false, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "question": { - "id": "primary-confirmation-question", - "type": "General", - "title": "Do you live here?", - "answers": [ - { - "id": "you-live-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "household", - "same_name_answer_ids": ["first-name", "last-name"], - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "middle-names", - "label": "Middle names", - "mandatory": false, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "middle-names", - "label": "Middle names", - "mandatory": false, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": { - "text": "Household members staying overnight on {census_date}", - "placeholders": [ - { - "placeholder": "census_date", - "transforms": [ - { - "arguments": { - "date_format": "d MMMM yyyy", - "date_to_format": { - "value": "2019-10-13" - } - }, - "transform": "format_date" - } - ] - } - ] - }, - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "id": "visitor-list-collector", - "type": "ListCollector", - "for_list": "visitor", - "question": { - "id": "visitor-question", - "type": "General", - "title": "Any visitors?", - "answers": [ - { - "id": "any-visitors", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-visitor", - "type": "ListAddQuestion", - "question": { - "id": "visitor-add-person", - "type": "General", - "title": "What is the name of the visitor?", - "answers": [ - { - "id": "visitor-first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "visitor-middle-names", - "label": "Middle names", - "mandatory": false, - "type": "TextField" - }, - { - "id": "visitor-last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "visitor-edit-person", - "type": "ListEditQuestion", - "question": { - "id": "visitor-edit-question", - "type": "General", - "title": "What is the name of the visitor?", - "answers": [ - { - "id": "visitor-first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "visitor-middle-names", - "label": "Middle names", - "mandatory": false, - "type": "TextField" - }, - { - "id": "visitor-last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "visitor-remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "visitor-remove-question", - "type": "General", - "title": "Are you sure you want to remove this visitor?", - "answers": [ - { - "id": "visitor-remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Visitors", - "item_title": { - "text": "{visitor_name}", - "placeholders": [ - { - "placeholder": "visitor_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "visitor-first-name" - }, - { - "source": "answers", - "identifier": "visitor-last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "groups": [ - { - "blocks": [ - { - "content": { - "contents": [ - { - "description": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ], - "text": "In this section, we are going to ask you questions about {person_name}." - } - }, - { - "list": ["date of birth"], - "title": "You will need to know personal details such as" - } - ], - "title": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ], - "text": "{person_name}" - } - }, - "id": "individual-interstitial", - "type": "Interstitial" - }, - { - "content": { - "contents": [ - { - "description": "Another interstitial page to ensure that the individual response guidance is only displayed for the first block in the individual section." - } - ], - "title": "Another interstitial" - }, - "id": "another-interstitial", - "page_title": "Another interstitial", - "type": "Interstitial" - }, - { - "id": "proxy", - "question": { - "answers": [ - { - "default": "No, I am answering on their behalf", - "id": "proxy-answer", - "mandatory": false, - "options": [ - { - "label": "Yes, I am", - "value": "Yes, I am" - }, - { - "label": "No, I am answering on their behalf", - "value": "No, I am answering on their behalf" - } - ], - "type": "Radio" - } - ], - "id": "proxy-question", - "title": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ], - "text": "Are you {person_name}?" - }, - "type": "General" - }, - "type": "Question" - } - ], - "id": "personal-details-group", - "title": "Personal Details" - } - ], - "id": "individual-section", - "repeat": { - "for_list": "household", - "title": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ], - "text": "{person_name}" - } - }, - "summary": { - "show_on_completion": false - }, - "title": "Individual Section" - } - ] -} diff --git a/schemas/test/en/test_individual_response_on_hub_disabled.json b/schemas/test/en/test_individual_response_on_hub_disabled.json deleted file mode 100644 index 8e64f1967b..0000000000 --- a/schemas/test/en/test_individual_response_on_hub_disabled.json +++ /dev/null @@ -1,448 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "census", - "title": "Test Individual Response", - "theme": "default", - "description": "A questionnaire to test individual response", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "display_address", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { "required_completed_sections": ["section"] } - }, - "individual_response": { - "show_on_hub": false, - "for_list": "household", - "individual_section_id": "individual-section" - }, - "sections": [ - { - "id": "section", - "title": "People who live here", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "household", - "title": { - "text": "Household members staying overnight on {census_date}", - "placeholders": [ - { - "placeholder": "census_date", - "transforms": [ - { - "arguments": { - "date_format": "d MMMM yyyy", - "date_to_format": { - "value": "2019-10-13" - } - }, - "transform": "format_date" - } - ] - } - ] - }, - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "Questions", - "blocks": [ - { - "id": "primary-person-list-collector", - "type": "PrimaryPersonListCollector", - "for_list": "household", - "add_or_edit_block": { - "id": "add-or-edit-primary-person", - "type": "PrimaryPersonListAddOrEditQuestion", - "question": { - "id": "primary-person-add-or-edit-question", - "type": "General", - "title": "What is your name?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "question": { - "id": "primary-confirmation-question", - "type": "General", - "title": "Do you live here?", - "answers": [ - { - "id": "you-live-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "household", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": { - "text": "Household members staying overnight on {census_date}", - "placeholders": [ - { - "placeholder": "census_date", - "transforms": [ - { - "arguments": { - "date_format": "d MMMM yyyy", - "date_to_format": { - "value": "2019-10-13" - } - }, - "transform": "format_date" - } - ] - } - ] - }, - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "groups": [ - { - "blocks": [ - { - "content": { - "contents": [ - { - "description": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ], - "text": "In this section, we are going to ask you questions about {person_name}." - } - }, - { - "list": ["date of birth"], - "title": "You will need to know personal details such as" - } - ], - "title": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ], - "text": "{person_name}" - } - }, - "id": "individual-interstitial", - "type": "Interstitial" - }, - { - "id": "proxy", - "question": { - "answers": [ - { - "default": "No, I am answering on their behalf", - "id": "proxy-answer", - "mandatory": false, - "options": [ - { - "label": "Yes, I am", - "value": "Yes, I am" - }, - { - "label": "No, I am answering on their behalf", - "value": "No, I am answering on their behalf" - } - ], - "type": "Radio" - } - ], - "id": "proxy-question", - "title": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ], - "text": "Are you {person_name}?" - }, - "type": "General" - }, - "type": "Question" - } - ], - "id": "personal-details-group", - "title": "Personal Details" - } - ], - "id": "individual-section", - "repeat": { - "for_list": "household", - "title": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ], - "text": "{person_name}" - } - }, - "summary": { - "show_on_completion": false - }, - "title": "Individual Section" - } - ] -} diff --git a/schemas/test/en/test_instructions.json b/schemas/test/en/test_instructions.json deleted file mode 100644 index d80841ce84..0000000000 --- a/schemas/test/en/test_instructions.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Interstitial Pages", - "theme": "default", - "description": "A questionnaire to demo interstitial pages.", - "messages": { - "NUMBER_TOO_LARGE": "Number is too large", - "NUMBER_TOO_SMALL": "Number cannot be less than zero", - "INVALID_NUMBER": "Please enter an integer" - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": {} - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Introduction", - "id": "introduction" - }, - { - "id": "interstitial", - "content": { - "title": "Breakfast interstitial", - "instruction": ["Just pause for a second"], - "contents": [ - { - "description": "Next we want to know about your lunch." - } - ] - }, - "type": "Interstitial" - }, - { - "type": "Question", - "id": "lunch-block", - "question": { - "instruction": ["Tell us about what you eat"], - "answers": [ - { - "id": "favourite-lunch", - "label": "What is your favourite lunchtime food", - "mandatory": false, - "type": "TextField" - } - ], - "id": "favourite-lunch-question", - "title": "Title", - "type": "General" - } - } - ], - "id": "favourite-foods", - "title": "Favourite food" - } - ] - } - ] -} diff --git a/schemas/test/en/test_interstitial_definition.json b/schemas/test/en/test_interstitial_definition.json deleted file mode 100644 index 27ae0408ee..0000000000 --- a/schemas/test/en/test_interstitial_definition.json +++ /dev/null @@ -1,170 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Interstitial definition", - "theme": "default", - "description": "A questionnaire to demo a definition in an interstitial page.", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "interstitial-section", - "groups": [ - { - "blocks": [ - { - "id": "interstitial-definition", - "content": { - "title": "Interstitial Definition", - "contents": [ - { - "description": "You have successfully launched the test_interstitial_definition questionnaire" - }, - { - "definition": { - "title": "Successfully", - "contents": [ - { - "description": "In a way that accomplishes a desired aim or result" - } - ] - } - }, - { - "description": "You can now continue." - } - ] - }, - "type": "Interstitial" - }, - { - "type": "Question", - "id": "content-variant-definition", - "question": { - "answers": [ - { - "id": "content-variant-definition-answer", - "mandatory": true, - "options": [ - { - "label": "Answer", - "value": "Answer" - }, - { - "label": "Question", - "value": "Question" - } - ], - "type": "Radio" - } - ], - "id": "content-variant-definition-question", - "type": "General", - "title": "What would you like to see a definition about?" - } - }, - { - "type": "Interstitial", - "id": "interstitial-content-variant-definition", - "content_variants": [ - { - "content": { - "title": "Content variant definition", - "contents": [ - { - "description": "According to your response you wanted to see a definition about an answer" - }, - { - "definition": { - "title": "According", - "contents": [ - { - "description": "As stated by or in." - } - ] - } - }, - { - "definition": { - "title": "Answer", - "contents": [ - { - "description": "A spoken or written reply or response to a question" - } - ] - } - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "content-variant-definition-answer" - }, - "Answer" - ] - } - }, - { - "content": { - "title": "Content variant definition", - "contents": [ - { - "description": "According to your response you wanted to see a definition about a question" - }, - { - "definition": { - "title": "Question", - "contents": [ - { - "description": "A sentence worded or expressed so as to elicit information" - } - ] - } - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "content-variant-definition-answer" - }, - "Question" - ] - } - } - ] - } - ], - "id": "interstitial", - "title": "Interstitial Definition" - } - ] - } - ] -} diff --git a/schemas/test/en/test_interstitial_page.json b/schemas/test/en/test_interstitial_page.json deleted file mode 100644 index 18b59c4440..0000000000 --- a/schemas/test/en/test_interstitial_page.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Interstitial Pages", - "theme": "default", - "description": "A questionnaire to demo interstitial pages.", - "messages": { - "NUMBER_TOO_LARGE": "Number is too large", - "NUMBER_TOO_SMALL": "Number cannot be less than zero", - "INVALID_NUMBER": "Please enter an integer" - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": {} - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Introduction", - "id": "introduction" - }, - { - "type": "Question", - "id": "breakfast-block", - "question": { - "answers": [ - { - "id": "favourite-breakfast", - "label": "What is your favourite breakfast food", - "mandatory": false, - "type": "TextField" - } - ], - "id": "favourite-breakfast-question", - "title": "What is your favourite breakfast food", - "type": "General" - } - }, - { - "id": "breakfast-interstitial", - "content": { - "title": "Breakfast interstitial", - "contents": [ - { - "description": "You have successfully completed the breakfast section. Next we want to know about your lunch." - } - ] - }, - "type": "Interstitial" - }, - { - "type": "Question", - "id": "lunch-block", - "question": { - "answers": [ - { - "id": "favourite-lunch", - "label": "What is your favourite lunchtime food", - "mandatory": false, - "type": "TextField" - } - ], - "id": "favourite-lunch-question", - "title": "Title", - "type": "General" - } - } - ], - "id": "favourite-foods", - "title": "Favourite food" - } - ] - } - ] -} diff --git a/schemas/test/en/test_interstitial_page_title.json b/schemas/test/en/test_interstitial_page_title.json deleted file mode 100644 index 12f9b9b766..0000000000 --- a/schemas/test/en/test_interstitial_page_title.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Interstitial Page Titles", - "theme": "default", - "description": "A questionnaire to demo interstitial pages titles.", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": {} - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "id": "interstitial-page", - "content": { - "title": { - "placeholders": [ - { - "placeholder": "ru_name", - "value": { - "identifier": "ru_name", - "source": "metadata" - } - } - ], - "text": "Your RU name: {ru_name}" - }, - "contents": [ - { - "description": "You have successfully completed the section." - } - ] - }, - "type": "Interstitial" - } - ], - "id": "interstitial-page-titles", - "title": "Interstitial page titles" - } - ] - } - ] -} diff --git a/schemas/test/en/test_interviewer_note.json b/schemas/test/en/test_interviewer_note.json deleted file mode 100644 index 3d67b35043..0000000000 --- a/schemas/test/en/test_interviewer_note.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Interviewer Note Pages", - "theme": "default", - "description": "A questionnaire to demo interviewer note highlighting.", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": {} - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "blocks": [ - { - "id": "initial-interstitial-block", - "interviewer_only": true, - "content": { - "title": "Favourite team interstitial", - "contents": [ - { - "description": "In this section we will ask you about your favourite team." - } - ] - }, - "type": "Interstitial" - }, - { - "type": "Question", - "id": "favourite-team-block", - "interviewer_only": true, - "question": { - "answers": [ - { - "id": "favourite-team-answer", - "label": "Favourite team", - "mandatory": false, - "type": "TextField" - } - ], - "id": "favourite-team-question", - "title": "Who is your favourite team?", - "type": "General" - } - }, - { - "type": "Question", - "id": "confirm-block", - "interviewer_only": false, - "question": { - "answers": [ - { - "options": [ - { - "label": "Yes", - "value": "Yes" - } - ], - "id": "confirm-answer", - "mandatory": false, - "type": "Checkbox" - } - ], - "id": "confirm-question", - "title": { - "text": "Can you confirm that {team} is your favourite team?", - "placeholders": [ - { - "placeholder": "team", - "value": { "source": "answers", "identifier": "favourite-team-answer" } - } - ] - }, - "type": "General" - } - }, - { - "id": "final-interstitial-block", - "content": { - "title": "Final interstitial", - "contents": [ - { - "description": "You have successfully completed favourite team section." - } - ] - }, - "type": "Interstitial" - } - ], - "id": "favourite-team", - "title": "Favourite team" - } - ] - } - ] -} diff --git a/schemas/test/en/test_introduction.json b/schemas/test/en/test_introduction.json deleted file mode 100644 index c2ab5babf1..0000000000 --- a/schemas/test/en/test_introduction.json +++ /dev/null @@ -1,720 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "144", - "theme": "default", - "preview_questions": true, - "title": "Test introduction", - "legal_basis": "Notice is given under section 999 of the Test Act 2000", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "ru_ref", - "type": "string" - }, - { - "name": "trad_as", - "type": "string", - "optional": true - }, - { - "name": "ref_p_start_date", - "type": "date" - }, - { - "name": "ref_p_end_date", - "type": "date" - }, - { - "name": "display_address", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": {} - }, - "sections": [ - { - "id": "introduction-section", - "title": "Main section", - "groups": [ - { - "id": "introduction-group", - "title": "General Business Information", - "blocks": [ - { - "id": "introduction", - "type": "Introduction", - "primary_content": [ - { - "id": "business-details", - "title": { - "text": "You are completing this for {company_name}", - "placeholders": [ - { - "placeholder": "company_name", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "metadata", - "identifier": "trad_as" - }, - { - "source": "metadata", - "identifier": "ru_name" - } - ] - } - } - ] - } - ] - }, - "contents": [ - { - "description": { - "text": "If the company details or structure have changed contact us on {telephone_number_link} or email {email_link}", - "placeholders": [ - { - "placeholder": "telephone_number_link", - "transforms": [ - { - "transform": "telephone_number_link", - "arguments": { - "telephone_number": "0300 1234 931" - } - } - ] - }, - { - "placeholder": "email_link", - "transforms": [ - { - "transform": "email_link", - "arguments": { - "email_address": "surveys@ons.gov.uk", - "email_subject": "Change of details reference", - "email_subject_append": { - "identifier": "ru_ref", - "source": "metadata" - } - } - } - ] - } - ] - } - }, - { - "guidance": { - "contents": [ - { - "title": "Coronavirus (COVID-19) guidance", - "description": "Explain your figures in the comment section to minimise us contacting you and to help us tell an industry story" - } - ] - } - } - ] - }, - { - "id": "use-of-information", - "contents": [ - { - "list": [ - "Data should relate to all sites in England, Scotland and Wales unless otherwise stated.", - "You can provide informed estimates if actual figures aren’t available.", - "We will treat your data securely and confidentially." - ] - }, - { - "description": "To take part, all you need to do is check that you have the information you need to answer the survey questions." - } - ] - } - ], - "preview_content": { - "id": "preview", - "title": "Information you need", - "contents": [ - { - "description": "You can select the dates of the period you are reporting for, if the given dates are not appropriate." - }, - { - "description": "Read the detailed guidance for completing this survey" - } - ], - "questions": [ - { - "id": "employee-pay-frequency", - "question": "Employee pay frequency", - "contents": [ - { - "list": [ - "You will need to indicate how frequently employees are paid i.e weekly, fortnightly, calendar monthly, four weekly or five weekly.", - "You will be asked to answer the questions below for all of your selected pay patterns." - ] - } - ] - }, - { - "id": "what-you-need-to-know", - "question": "What you need to know", - "contents": [ - { - "list": [ - "You can provide informed estimates if actual figures aren’t available", - "All information you provide is strictly confidential" - ] - } - ] - }, - { - "id": "definition-of-innovation", - "question": "Definition of innovation", - "contents": [ - { - "description": { - "text": "Innovation, for the purpose of this survey, is defined as new or significantly improved goods or services as well as processes used to produce or supply all goods or services that {ru_name} has introduced, regardless of their origin.", - "placeholders": [ - { - "placeholder": "ru_name", - "value": { - "source": "metadata", - "identifier": "ru_name" - } - } - ] - } - }, - { - "description": { - "text": "These innovations may be new to {ru_name} or new to the market", - "placeholders": [ - { - "placeholder": "ru_name", - "value": { - "source": "metadata", - "identifier": "ru_name" - } - } - ] - } - }, - { - "description": { - "text": "Investments for future innovation and changes that {ru_name} has introduced at a strategic level (in organisation and practices) are also covered", - "placeholders": [ - { - "placeholder": "ru_name", - "value": { - "source": "metadata", - "identifier": "ru_name" - } - } - ] - } - } - ] - } - ] - }, - "secondary_content": [ - { - "id": "how-we-use-your-data", - "contents": [ - { - "title": "How we use your data", - "list": [ - "You cannot appeal your selection. Your business was selected to give us a comprehensive view of the UK economy", - "The data from you business is essential is it helps us calculate the GDP of the UK", - "Our surveys inform government decisions. For example, past statistics from our surveys led to the introduction of business grants" - ] - } - ] - } - ] - }, - { - "type": "Question", - "id": "report-radio", - "question": { - "guidance": { - "contents": [ - { - "description": "Please provide figures for the period in which you were trading." - } - ] - }, - "description": ["

Your return should relate to the calendar year 2021.

"], - "instruction": ["Select your answer"], - "answers": [ - { - "id": "report-radio-answer", - "mandatory": true, - "description": "Select your answer", - "guidance": { - "show_guidance": "Additional guidance", - "hide_guidance": "Additional guidance", - "contents": [ - { - "description": "For example select `yes` if you can report for this period" - } - ] - }, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ], - "id": "report-radio-question", - "title": { - "text": "Are you able to report for the calendar month {start_date} to {end_date}?", - "placeholders": [ - { - "placeholder": "start_date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "end_date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_end_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General" - } - }, - { - "type": "Question", - "id": "reporting-date", - "question": { - "id": "projects-checkbox-question", - "title": "What dates will you be reporting for?", - "description": [ - "

If figures are not available for the calendar year 2021, your return should relate to a 12 month business year that ends between 6 April 2021 and 5 April 2022.

" - ], - "type": "DateRange", - "answers": [ - { - "id": "answer-from", - "type": "Date", - "mandatory": true, - "label": "Period from", - "minimum": { - "value": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "offset_by": { - "days": -31 - } - } - }, - { - "id": "answer-to", - "type": "Date", - "mandatory": true, - "label": "Period to", - "maximum": { - "value": { - "source": "metadata", - "identifier": "ref_p_end_date" - }, - "offset_by": { - "days": 31 - } - } - } - ], - "guidance": { - "contents": [ - { - "description": "

Only traded for a part of the year?

" - }, - { - "description": "

Please provide figures for the period in which you were trading.

" - }, - { - "description": "

Only commenced trading during 2021?

" - }, - { - "description": "

Your return should cover the period from the commencement of your business until 31 December 2021 or, alternatively, any date up to 5 April 2022.

" - }, - { - "description": "

Ceased trading during 2021?

" - }, - { - "description": "

Your return should cover the period 1 January 2021 to the date you ceased to trade or, alternatively, from the beginning of your last business year up to the cessation date.

" - } - ] - } - } - }, - { - "type": "Question", - "id": "report-radio-second", - "question": { - "description": ["

Your return should relate to the calendar year 2021.

"], - "instruction": ["Select your answer"], - "answers": [ - { - "id": "report-radio-second-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ], - "id": "report-radio-second-question", - "title": { - "text": "Are you sure you are able to report for the calendar month {calendar_start_date} to {calendar_end_date}?", - "placeholders": [ - { - "placeholder": "calendar_start_date", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "identifier": "answer-from", - "source": "answers" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "calendar_end_date", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "identifier": "answer-to", - "source": "answers" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General" - } - }, - { - "type": "Question", - "id": "projects-checkbox", - "question": { - "answers": [ - { - "id": "projects-checkbox-answer", - "instruction": "Select any answers that apply", - "mandatory": true, - "options": [ - { - "label": "Public sector projects", - "value": "Public sector projects", - "description": "This includes public housing and government owned organisations such as local, regional and national public authorities and agencies" - }, - { - "label": "Private sector projects", - "value": "Private sector projects", - "description": "This refers to the part of the economy that is for profit and is owned by private organisations. For example privately owned businesses, housing associations, partnerships and sole traders, joint ventures and privately owned housing" - } - ], - "type": "Checkbox" - } - ], - "id": "projects-checkbox-question-2", - "title": { - "text": "Which sector did {ru_name} carry out work for?", - "placeholders": [ - { - "placeholder": "ru_name", - "value": { - "source": "metadata", - "identifier": "ru_name" - } - } - ] - }, - "type": "General", - "guidance": { - "contents": [ - { - "description": "Include:" - }, - { - "list": ["Local public authorities and agencies", "Regional and national authorities and agencies"] - } - ] - } - } - }, - { - "type": "Question", - "id": "turnover-variants-block", - "question_variants": [ - { - "question": { - "guidance": { - "contents": [ - { - "description": "Include:" - }, - { - "list": [ - "exports", - "payments for work in progress", - "costs incurred and passed on to customers", - "income from sub-contracted activities", - "commission", - "sales of goods purchased for resale", - "revenue earned from other parts of the business not named, please supply at fair value" - ] - }, - { - "description": "Exclude:" - }, - { - "list": [ - "VAT", - "income from the sale of fixed capital assets", - "grants and subsidies", - "insurance claims", - "interest received" - ] - } - ] - }, - "id": "turnover-variants-question", - "title": "What was your total turnover", - "type": "General", - "answers": [ - { - "id": "turnover-variants-answer", - "mandatory": false, - "type": "TextField", - "label": "Total turnover" - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "report-radio-answer" - }, - "Yes" - ] - } - }, - { - "question": { - "id": "turnover-variants-question", - "title": "Why are you not able to report?", - "type": "General", - "answers": [ - { - "id": "turnover-variants-answer", - "mandatory": false, - "type": "TextField", - "label": "Details" - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "report-radio-answer" - }, - "No" - ] - } - } - ] - }, - { - "type": "Question", - "id": "address-mutually-exclusive-checkbox", - "question": { - "id": "address-mutually-exclusive-checkbox-question", - "type": "MutuallyExclusive", - "title": "Were your company based at any of the following addresses?", - "mandatory": true, - "answers": [ - { - "id": "address-checkbox-answer", - "instruction": "Select an answer", - "type": "Checkbox", - "mandatory": false, - "options": [ - { - "label": { - "placeholders": [ - { - "placeholder": "company_address", - "value": { - "identifier": "display_address", - "source": "metadata" - } - } - ], - "text": "{company_address}" - }, - "value": "{company_address}" - }, - { - "label": "7 Evelyn Street, Barry", - "value": "7 Evelyn Street, Barry" - }, - { - "label": "251 Argae Lane, Barry", - "value": "251 Argae Lane, Barry" - } - ] - }, - { - "id": "address-checkbox-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "description": "Some description", - "value": "I prefer not to say" - } - ] - } - ] - } - }, - { - "id": "further-details-text-area", - "type": "Question", - "question": { - "id": "further-details-text-area-question", - "title": "Please provide any further details", - "type": "General", - "description": [ - { - "text": "

Answer for {ru_name}

", - "placeholders": [ - { - "placeholder": "ru_name", - "value": { - "source": "metadata", - "identifier": "ru_name" - } - } - ] - } - ], - "answers": [ - { - "id": "further-details-text-area-answer", - "mandatory": false, - "type": "TextArea", - "label": "Comments", - "max_length": 2000 - } - ] - } - }, - { - "type": "Interstitial", - "id": "general-business-information-completed", - "content": { - "title": "Section complete", - "contents": [ - { - "description": "

You have successfully completed this section

The next section covers changes in business strategy and practices, for example, implementing changes to marketing concepts or strategies.

" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_introduction_hub.json b/schemas/test/en/test_introduction_hub.json deleted file mode 100644 index d0e761c80c..0000000000 --- a/schemas/test/en/test_introduction_hub.json +++ /dev/null @@ -1,636 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "144", - "theme": "default", - "preview_questions": true, - "title": "Test introduction preview questions with hub", - "legal_basis": "Notice is given under section 999 of the Test Act 2000", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "ru_ref", - "type": "string" - }, - { - "name": "trad_as", - "type": "string", - "optional": true - }, - { - "name": "ref_p_start_date", - "type": "date" - }, - { - "name": "ref_p_end_date", - "type": "date" - }, - { - "name": "display_address", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { - "required_completed_sections": ["introduction-section"] - } - }, - "sections": [ - { - "id": "introduction-section", - "title": "Main section", - "summary": { - "page_title": "Summary title", - "show_on_completion": true - }, - "show_on_hub": true, - "groups": [ - { - "id": "introduction-group", - "title": "General Business Information", - "blocks": [ - { - "id": "introduction", - "type": "Introduction", - "primary_content": [ - { - "id": "business-details", - "title": { - "text": "You are completing this for {company_name}", - "placeholders": [ - { - "placeholder": "company_name", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "metadata", - "identifier": "trad_as" - }, - { - "source": "metadata", - "identifier": "ru_name" - } - ] - } - } - ] - } - ] - }, - "contents": [ - { - "description": { - "text": "If the company details or structure have changed contact us on {telephone_number_link} or email {email_link}", - "placeholders": [ - { - "placeholder": "telephone_number_link", - "transforms": [ - { - "transform": "telephone_number_link", - "arguments": { - "telephone_number": "0300 1234 931" - } - } - ] - }, - { - "placeholder": "email_link", - "transforms": [ - { - "transform": "email_link", - "arguments": { - "email_address": "surveys@ons.gov.uk", - "email_subject": "Change of details reference", - "email_subject_append": { - "identifier": "ru_ref", - "source": "metadata" - } - } - } - ] - } - ] - } - }, - { - "guidance": { - "contents": [ - { - "title": "Coronavirus (COVID-19) guidance", - "description": "Explain your figures in the comment section to minimise us contacting you and to help us tell an industry story" - } - ] - } - } - ] - }, - { - "id": "use-of-information", - "contents": [ - { - "list": [ - "Data should relate to all sites in England, Scotland and Wales unless otherwise stated.", - "You can provide informed estimates if actual figures aren’t available.", - "We will treat your data securely and confidentially." - ] - }, - { - "description": "To take part, all you need to do is check that you have the information you need to answer the survey questions." - } - ] - } - ], - "secondary_content": [ - { - "id": "how-we-use-your-data", - "contents": [ - { - "title": "How we use your data", - "list": [ - "You cannot appeal your selection. Your business was selected to give us a comprehensive view of the UK economy", - "The data from you business is essential is it helps us calculate the GDP of the UK", - "Our surveys inform government decisions. For example, past statistics from our surveys led to the introduction of business grants" - ] - } - ] - } - ] - }, - { - "type": "Question", - "id": "report-radio", - "question": { - "guidance": { - "contents": [ - { - "description": "Please provide figures for the period in which you were trading." - } - ] - }, - "description": ["

Your return should relate to the calendar year 2021.

"], - "instruction": ["Select your answer"], - "answers": [ - { - "id": "report-radio-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ], - "id": "report-radio-question", - "title": { - "text": "Are you able to report for the calendar month {start_date} to {end_date}?", - "placeholders": [ - { - "placeholder": "start_date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "end_date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_end_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General" - } - }, - { - "type": "Question", - "id": "reporting-date", - "question": { - "id": "projects-checkbox-question", - "title": "What dates will you be reporting for?", - "description": [ - "

If figures are not available for the calendar year 2021, your return should relate to a 12 month business year that ends between 6 April 2021 and 5 April 2022.

" - ], - "type": "DateRange", - "answers": [ - { - "id": "answer-from", - "type": "Date", - "mandatory": true, - "label": "Period from", - "minimum": { - "value": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "offset_by": { - "days": -31 - } - } - }, - { - "id": "answer-to", - "type": "Date", - "mandatory": true, - "label": "Period to", - "maximum": { - "value": { - "source": "metadata", - "identifier": "ref_p_end_date" - }, - "offset_by": { - "days": 31 - } - } - } - ], - "guidance": { - "contents": [ - { - "description": "

Only traded for a part of the year?

" - }, - { - "description": "

Please provide figures for the period in which you were trading.

" - }, - { - "description": "

Only commenced trading during 2021?

" - }, - { - "description": "

Your return should cover the period from the commencement of your business until 31 December 2021 or, alternatively, any date up to 5 April 2022.

" - }, - { - "description": "

Ceased trading during 2021?

" - }, - { - "description": "

Your return should cover the period 1 January 2021 to the date you ceased to trade or, alternatively, from the beginning of your last business year up to the cessation date.

" - } - ] - } - } - }, - { - "type": "Question", - "id": "report-radio-second", - "question": { - "description": ["

Your return should relate to the calendar year 2021.

"], - "instruction": ["Select your answer"], - "answers": [ - { - "id": "report-radio-second-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ], - "id": "report-radio-second-question", - "title": { - "text": "Are you sure you are able to report for the calendar month {calendar_start_date} to {calendar_end_date}?", - "placeholders": [ - { - "placeholder": "calendar_start_date", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "identifier": "answer-from", - "source": "answers" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "calendar_end_date", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "identifier": "answer-to", - "source": "answers" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General" - } - }, - { - "type": "Question", - "id": "projects-checkbox", - "question": { - "answers": [ - { - "id": "projects-checkbox-answer", - "instruction": "Select any answers that apply", - "mandatory": true, - "options": [ - { - "label": "Public sector projects", - "value": "Public sector projects", - "description": "This includes public housing and government owned organisations such as local, regional and national public authorities and agencies" - }, - { - "label": "Private sector projects", - "value": "Private sector projects", - "description": "This refers to the part of the economy that is for profit and is owned by private organisations. For example privately owned businesses, housing associations, partnerships and sole traders, joint ventures and privately owned housing" - } - ], - "type": "Checkbox" - } - ], - "id": "projects-checkbox-question-2", - "title": { - "text": "Which sector did {ru_name} carry out work for?", - "placeholders": [ - { - "placeholder": "ru_name", - "value": { - "source": "metadata", - "identifier": "ru_name" - } - } - ] - }, - "type": "General", - "guidance": { - "contents": [ - { - "description": "Include:" - }, - { - "list": ["Local public authorities and agencies", "Regional and national authorities and agencies"] - } - ] - } - } - }, - { - "type": "Question", - "id": "turnover-variants-block", - "question_variants": [ - { - "question": { - "guidance": { - "contents": [ - { - "description": "Include:" - }, - { - "list": [ - "exports", - "payments for work in progress", - "costs incurred and passed on to customers", - "income from sub-contracted activities", - "commission", - "sales of goods purchased for resale", - "revenue earned from other parts of the business not named, please supply at fair value" - ] - }, - { - "description": "Exclude:" - }, - { - "list": [ - "VAT", - "income from the sale of fixed capital assets", - "grants and subsidies", - "insurance claims", - "interest received" - ] - } - ] - }, - "id": "turnover-variants-question", - "title": "What was your total turnover", - "type": "General", - "answers": [ - { - "id": "turnover-variants-answer", - "mandatory": false, - "type": "TextField", - "label": "Total turnover" - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "report-radio-answer" - }, - "Yes" - ] - } - }, - { - "question": { - "id": "turnover-variants-question", - "title": "Why are you not able to report?", - "type": "General", - "answers": [ - { - "id": "turnover-variants-answer", - "mandatory": false, - "type": "TextField", - "label": "Details" - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "report-radio-answer" - }, - "No" - ] - } - } - ] - }, - { - "type": "Question", - "id": "address-mutually-exclusive-checkbox", - "question": { - "id": "address-mutually-exclusive-checkbox-question", - "type": "MutuallyExclusive", - "title": "Were your company based at any of the following addresses?", - "mandatory": true, - "answers": [ - { - "id": "address-checkbox-answer", - "instruction": "Select an answer", - "type": "Checkbox", - "mandatory": false, - "options": [ - { - "label": { - "placeholders": [ - { - "placeholder": "company_address", - "value": { - "identifier": "display_address", - "source": "metadata" - } - } - ], - "text": "{company_address}" - }, - "value": "{company_address}" - }, - { - "label": "7 Evelyn Street, Barry", - "value": "7 Evelyn Street, Barry" - }, - { - "label": "251 Argae Lane, Barry", - "value": "251 Argae Lane, Barry" - } - ] - }, - { - "id": "address-checkbox-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "description": "Some description", - "value": "I prefer not to say" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "additional-section", - "title": "Additional section", - "summary": { - "page_title": "Summary title", - "show_on_completion": true - }, - "show_on_hub": true, - "groups": [ - { - "id": "additional-group", - "title": "Additional Business Information", - "blocks": [ - { - "id": "further-details-text-area", - "type": "Question", - "question": { - "id": "further-details-text-area-question", - "title": "Please provide any further details", - "type": "General", - "description": [ - { - "text": "

Answer for {ru_name}

", - "placeholders": [ - { - "placeholder": "ru_name", - "value": { - "source": "metadata", - "identifier": "ru_name" - } - } - ] - } - ], - "answers": [ - { - "id": "further-details-text-area-answer", - "mandatory": false, - "type": "TextArea", - "label": "Comments", - "max_length": 2000 - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_language.json b/schemas/test/en/test_language.json deleted file mode 100644 index a48c51be0f..0000000000 --- a/schemas/test/en/test_language.json +++ /dev/null @@ -1,246 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Language Survey", - "theme": "social", - "description": "A questionnaire to demonstrate language switching", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "submission": { - "button": "Submission button", - "guidance": "Submission guidance", - "title": "Submission title", - "warning": "Submission warning" - }, - "sections": [ - { - "id": "default-section", - "title": "Household details", - "groups": [ - { - "id": "language-group", - "blocks": [ - { - "type": "Question", - "id": "name-block", - "question": { - "instruction": ["Enter the name of a person"], - "description": ["The full name of the person"], - "id": "name-question", - "title": "Please enter a name", - "type": "General", - "answers": [ - { - "id": "first-name", - "label": "First Name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last Name", - "mandatory": false, - "type": "TextField" - } - ] - } - }, - { - "type": "Question", - "id": "dob-block", - "question": { - "description": [ - { - "text": "{person_name_possessive} date of birth", - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ] - } - ], - "id": "dob-question", - "title": { - "text": "What is {person_name_possessive} date of birth?", - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "date-of-birth-answer", - "description": "Enter your date of birth", - "label": "Date of Birth", - "mandatory": true, - "type": "Date" - } - ] - } - }, - { - "type": "Question", - "id": "number-of-people-block", - "question": { - "answers": [ - { - "id": "number-of-people-answer", - "label": "Number of household residents", - "mandatory": true, - "type": "Number", - "minimum": { - "value": 0 - }, - "maximum": { - "value": 100 - } - } - ], - "description": ["The total number of people in the household"], - "warning": "This is a very important question", - "id": "number-of-people-question", - "title": "How many people live at your household?", - "type": "General" - } - }, - { - "type": "Question", - "id": "confirm-number-of-people", - "question": { - "type": "General", - "id": "total-people-question", - "title": { - "text_plural": { - "forms": { - "one": "{number_of_people} person lives here, is this correct?", - "other": "{number_of_people} people live here, is this correct?" - }, - "count": { - "source": "answers", - "identifier": "number-of-people-answer" - } - }, - "placeholders": [ - { - "placeholder": "number_of_people", - "value": { - "source": "answers", - "identifier": "number-of-people-answer" - } - } - ] - }, - "answers": [ - { - "id": "confirm-count", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": { - "text_plural": { - "forms": { - "one": "Yes, {number_of_people} person lives here", - "other": "Yes, {number_of_people} people live here" - }, - "count": { - "source": "answers", - "identifier": "number-of-people-answer" - } - }, - "placeholders": [ - { - "placeholder": "number_of_people", - "value": { - "source": "answers", - "identifier": "number-of-people-answer" - } - } - ] - }, - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_last_viewed_question_guidance.json b/schemas/test/en/test_last_viewed_question_guidance.json deleted file mode 100644 index 7b6b183db1..0000000000 --- a/schemas/test/en/test_last_viewed_question_guidance.json +++ /dev/null @@ -1,976 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test last viewed question guidance", - "theme": "default", - "description": "A questionnaire to test last viewed question guidance on different block types", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": {} - }, - "sections": [ - { - "id": "section", - "title": "Household members", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": "Household members", - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "Household members", - "blocks": [ - { - "id": "household-interstitial", - "content": { - "title": "Household interstitial", - "contents": [ - { - "description": "The following section concerns household members" - } - ] - }, - "type": "Interstitial" - }, - { - "type": "Question", - "id": "address-confirmation", - "question": { - "type": "General", - "id": "address-confirmation-question", - "title": "Is this property 742 Evergreen Terrace?", - "answers": [ - { - "type": "Radio", - "id": "address-confirmation-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "id": "primary-person-list-collector", - "type": "PrimaryPersonListCollector", - "for_list": "people", - "add_or_edit_block": { - "id": "add-or-edit-primary-person", - "type": "PrimaryPersonListAddOrEditQuestion", - "question": { - "id": "primary-person-add-or-edit-question", - "type": "General", - "title": "What is your name", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "question": { - "id": "primary-confirmation-question", - "type": "General", - "title": "Do you live here?", - "answers": [ - { - "id": "you-live-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "id": "anyone-usually-live-at", - "question": { - "answers": [ - { - "id": "anyone-usually-live-at-answer", - "mandatory": true, - "options": [ - { - "action": { - "params": { - "block_id": "add-person", - "list_name": "people" - }, - "type": "RedirectToListAddBlock" - }, - "label": "Yes", - "value": "Yes" - }, - { - "description": "For example, this is a second address or holiday home", - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "anyone-usually-live-at-question", - "title": "Does anyone else live at your address?", - "type": "General" - }, - "routing_rules": [ - { - "section": "End", - "when": { - "and": [ - { - "==": [ - { - "identifier": "anyone-usually-live-at-answer", - "source": "answers" - }, - "No" - ] - }, - { - "<": [ - { - "source": "list", - "identifier": "people", - "selector": "count" - }, - 1 - ] - } - ] - } - }, - { - "block": "list-collector" - } - ], - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "you-live-here", - "source": "answers" - }, - "Yes" - ] - } - }, - "type": "Question" - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": { - "text": "Change details for {first_name} {last_name}", - "placeholders": [ - { - "placeholder": "first_name", - "value": { - "source": "answers", - "identifier": "first-name" - } - }, - { - "placeholder": "last_name", - "value": { - "source": "answers", - "identifier": "last-name" - } - } - ] - }, - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "relationships-section", - "groups": [ - { - "blocks": [ - { - "id": "relationship-interstitial", - "content": { - "title": "relationship interstitial", - "contents": [ - { - "description": "The following section deals with the relationships in your household." - } - ] - }, - "type": "Interstitial" - }, - { - "type": "RelationshipCollector", - "id": "relationships", - "title": "This will iterate over the people list, capturing the one way relationships.", - "for_list": "people", - "question": { - "id": "relationship-question", - "type": "General", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their ", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "answers": [ - { - "id": "relationship-answer", - "mandatory": true, - "type": "Relationship", - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} ", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "options": [ - { - "label": "Husband or Wife", - "value": "Husband or Wife", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their husband or wife", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} husband or wife", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - { - "label": "Son or daughter", - "value": "Son or daughter", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their son or daughter", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} son or daughter", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - { - "label": "Brother or sister", - "value": "Brother or sister", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their brother or sister", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} brother or sister", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "description": "Including half brother or half sister" - } - ] - } - ] - }, - "skip_conditions": { - "when": { - "<": [ - { - "source": "list", - "identifier": "people", - "selector": "count" - }, - 2 - ] - } - } - } - ], - "id": "relationship-group", - "title": "Relationships" - } - ] - } - ] -} diff --git a/schemas/test/en/test_last_viewed_question_guidance_hub.json b/schemas/test/en/test_last_viewed_question_guidance_hub.json deleted file mode 100644 index cfac66b4b8..0000000000 --- a/schemas/test/en/test_last_viewed_question_guidance_hub.json +++ /dev/null @@ -1,235 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Hub & Spoke Last viewed question guidance", - "theme": "default", - "description": "A questionnaire to demo last viewed question guidance on hub and spoke", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { "required_completed_sections": ["work-section"] } - }, - "sections": [ - { - "id": "work-section", - "title": "Work", - "groups": [ - { - "id": "radio", - "title": "Radio Optional", - "blocks": [ - { - "id": "work-interstitial", - "content": { - "title": "Work interstitial", - "contents": [ - { - "description": "The following section concerns paid and unpaid work" - } - ] - }, - "type": "Interstitial" - }, - { - "type": "Question", - "id": "paid-work", - "question": { - "answers": [ - { - "id": "paid-work-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "paid-work-question", - "title": "In the last seven days, have you done any paid work?", - "type": "General" - } - }, - { - "type": "Question", - "id": "unpaid-work", - "question": { - "answers": [ - { - "id": "unpaid-work-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "unpaid-work-question", - "title": "In the last seven days, have you done any unpaid work?", - "type": "General" - } - } - ] - } - ] - }, - { - "id": "education-section", - "title": "Education", - "summary": { "show_on_completion": true }, - "groups": [ - { - "blocks": [ - { - "id": "gcses", - "question": { - "answers": [ - { - "id": "gcse-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "gcse-question", - "title": "Do you have any GCSEs?", - "type": "General" - }, - "type": "Question" - }, - { - "id": "a-levels", - "question": { - "answers": [ - { - "id": "alevels-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "alevels-question", - "title": "Do you have any A-levels?", - "type": "General" - }, - "type": "Question" - } - ], - "id": "education-group", - "title": "Education" - } - ] - }, - { - "id": "interests-section", - "title": "Interests (no summary)", - "groups": [ - { - "blocks": [ - { - "id": "sports", - "question": { - "answers": [ - { - "id": "sports-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "sports-question", - "title": "Do play any sports?", - "type": "General" - }, - "type": "Question" - }, - { - "id": "hobbies", - "question": { - "answers": [ - { - "id": "hobbies-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "hobbies-question", - "title": "Do you have any hobbies?", - "type": "General" - }, - "type": "Question" - } - ], - "id": "interests-group", - "title": "Interests" - } - ] - } - ] -} diff --git a/schemas/test/en/test_list_change_evaluates_sections.json b/schemas/test/en/test_list_change_evaluates_sections.json deleted file mode 100644 index fe038d1578..0000000000 --- a/schemas/test/en/test_list_change_evaluates_sections.json +++ /dev/null @@ -1,352 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test ListCollector Evaluate Sections", - "theme": "default", - "description": "A questionnaire to test that changes to a list update section completeness", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": "Household members", - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ] - }, - "id": "who-lives-here", - "title": "Who Lives Here", - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "primary-person-list-collector", - "type": "PrimaryPersonListCollector", - "for_list": "people", - "add_or_edit_block": { - "id": "add-or-edit-primary-person", - "type": "PrimaryPersonListAddOrEditQuestion", - "question": { - "id": "primary-person-add-or-edit-question", - "type": "General", - "title": "What is your name", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "question": { - "id": "primary-confirmation-question", - "type": "General", - "title": "Do you live here?", - "answers": [ - { - "id": "you-live-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "blocks": [ - { - "id": "accommodation-type", - "question": { - "answers": [ - { - "id": "accommodation-type-answer", - "mandatory": false, - "options": [ - { - "label": "Whole house or bungalow", - "value": "Whole house or bungalow" - }, - { - "description": "Including purpose-built flats and flats within converted and shared houses", - "label": "Flat, maisonette or apartment", - "value": "Flat, maisonette or apartment" - } - ], - "type": "Radio" - } - ], - "id": "accommodation-type-question", - "title": "What type of accommodation is your house?", - "type": "General" - }, - "type": "Question" - }, - { - "id": "central-heating", - "question": { - "answers": [ - { - "id": "central-heating-answer", - "mandatory": false, - "options": [ - { - "label": "District or communal heat networks", - "value": "District or communal heat networks" - }, - { - "label": "Other", - "value": "Other" - } - ], - "type": "Checkbox" - } - ], - "id": "central-heating-question", - "title": "What type of central heating does your house have?", - "type": "General" - }, - "routing_rules": [ - { - "section": "End", - "when": { - "==": [ - { - "source": "list", - "identifier": "people", - "selector": "count" - }, - 0 - ] - } - }, - { - "block": "own-or-rent" - } - ], - "type": "Question" - }, - { - "id": "own-or-rent", - "question": { - "answers": [ - { - "id": "own-or-rent-answer", - "mandatory": true, - "options": [ - { - "label": "Owns outright", - "value": "Owns outright" - }, - { - "label": "Owns with a mortgage or loan", - "value": "Owns with a mortgage or loan" - } - ], - "type": "Radio" - } - ], - "id": "own-or-rent-question", - "title": "Does your household own or rent?", - "type": "General" - }, - "type": "Question" - } - ], - "id": "accommodation-group" - } - ], - "id": "accommodation-section", - "title": "Household accommodation" - } - ] -} diff --git a/schemas/test/en/test_list_collector.json b/schemas/test/en/test_list_collector.json deleted file mode 100644 index 4dbb155473..0000000000 --- a/schemas/test/en/test_list_collector.json +++ /dev/null @@ -1,344 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test ListCollector", - "theme": "default", - "description": "A questionnaire to test ListCollector", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": {} - }, - "sections": [ - { - "id": "section", - "title": "List Collector Summary", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": "Household members", - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "cancel_text": "Don’t need to add anyone else?", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "cancel_text": "Don’t need to change anything?", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "cancel_text": "Don’t need to remove this person?", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "warning": "All of the information about this person will be deleted", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - }, - { - "id": "extra-list-group", - "title": "Another List", - "blocks": [ - { - "id": "next-interstitial", - "content": { - "title": "Another list", - "contents": [ - { - "description": "You have added some people to the ‘people’ list. Next we’ll test another list collector adding to the same list. This should still have the same list of people." - } - ] - }, - "type": "Interstitial" - }, - { - "id": "another-list-collector-block", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "another-confirmation-question", - "type": "General", - "title": "This list collector will add to the same ‘people’ list. Add someone else?", - "answers": [ - { - "id": "another-anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "another-add-person", - "type": "ListAddQuestion", - "question": { - "id": "another-add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "another-edit-person", - "type": "ListEditQuestion", - "question": { - "id": "another-edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "another-remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "another-remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "another-remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_list_collector_content_page.json b/schemas/test/en/test_list_collector_content_page.json deleted file mode 100644 index d31345c3ef..0000000000 --- a/schemas/test/en/test_list_collector_content_page.json +++ /dev/null @@ -1,550 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test List Collector Section Summary Items", - "theme": "default", - "description": "A questionnaire to test list collector section summary items", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { - "required_completed_sections": ["section-companies"] - } - }, - "post_submission": { - "view_response": true - }, - "sections": [ - { - "id": "section-companies", - "title": "General insurance business", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "companies", - "title": "Companies or UK branches", - "item_anchor_answer_id": "company-or-branch-name", - "item_label": "Name of UK company or branch", - "add_link_text": "Add another UK company or branch", - "empty_list_text": "No UK company or branch added", - "related_answers": [ - { - "source": "answers", - "identifier": "registration-number" - }, - { - "source": "answers", - "identifier": "authorised-insurer-radio" - } - ] - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "group-companies", - "blocks": [ - { - "type": "ListCollectorDrivingQuestion", - "id": "any-companies-or-branches", - "for_list": "companies", - "question": { - "type": "General", - "id": "any-companies-or-branches-question", - "title": "Do any companies or branches within your United Kingdom group undertake general insurance business?", - "answers": [ - { - "type": "Radio", - "id": "any-companies-or-branches-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-company", - "list_name": "companies" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "when": { - "==": [ - { - "source": "answers", - "identifier": "any-companies-or-branches-answer" - }, - "No" - ] - }, - "block": "confirmation-checkbox" - }, - { - "block": "any-other-companies-or-branches" - } - ] - }, - { - "id": "any-other-companies-or-branches", - "type": "ListCollector", - "for_list": "companies", - "question": { - "id": "any-other-companies-or-branches-question", - "type": "General", - "title": "Do you need to add any other UK companies or branches that undertake general insurance business?", - "answers": [ - { - "id": "any-other-companies-or-branches-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-company", - "type": "ListAddQuestion", - "question": { - "id": "add-question-companies", - "type": "General", - "title": "Give details about the company or branch that undertakes general insurance business", - "answers": [ - { - "id": "company-or-branch-name", - "label": "Name of UK company or branch", - "mandatory": true, - "type": "TextField" - }, - { - "id": "registration-number", - "label": "Registration number", - "mandatory": true, - "type": "Number", - "maximum": { - "value": 999, - "exclusive": false - }, - "decimal_places": 0 - }, - { - "type": "Radio", - "label": "Is this UK company or branch an authorised insurer?", - "id": "authorised-insurer-radio", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "edit_block": { - "id": "edit-company", - "type": "ListEditQuestion", - "question": { - "id": "edit-question-companies", - "type": "General", - "title": "What is the name of the company?", - "answers": [ - { - "id": "company-or-branch-name", - "label": "Name of UK company or branch", - "mandatory": true, - "type": "TextField" - }, - { - "id": "registration-number", - "label": "Registration number", - "mandatory": true, - "type": "Number" - }, - { - "type": "Radio", - "label": "Is this UK company or branch an authorised insurer?", - "id": "authorised-insurer-radio", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "remove_block": { - "id": "remove-company", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question-companies", - "type": "General", - "title": "Are you sure you want to remove this company or UK branch?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Companies or UK branches", - "item_title": { - "text": "{company_name}", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "answers", - "identifier": "company-or-branch-name" - } - } - ] - } - } - }, - { - "type": "Question", - "id": "confirmation-checkbox", - "question": { - "answers": [ - { - "id": "confirmation-checkbox-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "confirmation-checkbox-question", - "title": "Are all companies or branches based in UK?", - "type": "General" - }, - "skip_conditions": { - "when": { - "!=": [ - { - "count": [ - { - "source": "list", - "identifier": "companies" - } - ] - }, - 3 - ] - } - } - } - ] - } - ] - }, - { - "id": "section-list-collector-contents", - "title": "List Collector Contents", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "companies", - "title": "Companies or UK branches", - "item_label": "Name of UK company or branch" - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "group-list-collector-contents", - "title": "Companies", - "blocks": [ - { - "type": "Question", - "id": "responsible-party", - "question": { - "type": "General", - "id": "responsible-party-question", - "title": "Are you the responsible party for reporting trading details for a company of branch?", - "answers": [ - { - "type": "Radio", - "id": "responsible-party-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "list-collector-content", - "when": { - "==": [ - "Yes", - { - "source": "answers", - "identifier": "responsible-party-answer" - } - ] - } - }, - { - "section": "End" - } - ] - }, - { - "id": "list-collector-content", - "type": "ListCollectorContent", - "page_title": "Companies", - "for_list": "companies", - "summary": { - "title": "Companies or UK branches", - "item_title": { - "text": "{company_name}", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "answers", - "identifier": "company-or-branch-name" - } - } - ] - } - }, - "content": { - "title": "Companies", - "contents": [ - { - "guidance": { - "contents": [ - { - "description": "Include all companies" - } - ] - } - }, - { - "definition": { - "title": "Companies definition", - "contents": [ - { - "description": "Legal entities formed by a group of individuals to engage in and operate a business enterprise in a commercial or industrial capacity." - } - ] - } - }, - { - "description": "You have previously reported the following companies. Press continue to updated registration and trading information." - } - ] - }, - "repeating_blocks": [ - { - "id": "companies-repeating-block-1", - "type": "ListRepeatingQuestion", - "question": { - "id": "companies-repeating-block-1-question", - "type": "General", - "title": { - "text": "Give details about {company_name}", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "answers", - "identifier": "company-or-branch-name" - } - } - ] - }, - "answers": [ - { - "id": "registration-number-repeating-block", - "label": "Registration number (Mandatory)", - "mandatory": true, - "type": "Number", - "maximum": { - "value": 999, - "exclusive": false - }, - "decimal_places": 0 - }, - { - "id": "registration-date-repeating-block", - "label": "Date of Registration (Mandatory)", - "mandatory": true, - "type": "Date", - "maximum": { - "value": "now" - } - } - ] - } - }, - { - "id": "companies-repeating-block-2", - "type": "ListRepeatingQuestion", - "question": { - "id": "companies-repeating-block-2-question", - "type": "General", - "title": { - "text": "Give details about how {company_name} has been trading over the past {date_difference}.", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "answers", - "identifier": "company-or-branch-name" - } - }, - { - "placeholder": "date_difference", - "transforms": [ - { - "transform": "calculate_date_difference", - "arguments": { - "first_date": { - "source": "answers", - "identifier": "registration-date-repeating-block" - }, - "second_date": { - "value": "now" - } - } - } - ] - } - ] - }, - "answers": [ - { - "type": "Radio", - "label": "Has this company been trading in the UK? (Mandatory)", - "id": "authorised-trader-uk-radio-repeating-block", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - }, - { - "type": "Radio", - "label": "Has this company been trading in the EU? (Not mandatory)", - "id": "authorised-trader-eu-radio-repeating-block", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_list_collector_driving_checkbox.json b/schemas/test/en/test_list_collector_driving_checkbox.json deleted file mode 100644 index 6637a42efb..0000000000 --- a/schemas/test/en/test_list_collector_driving_checkbox.json +++ /dev/null @@ -1,699 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test driving checkbox question", - "theme": "default", - "description": "A questionnaire to test driving checkbox question", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section", - "title": "Who lives here?", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": "Household members", - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "Primary Person", - "blocks": [ - { - "id": "primary-person-list-collector", - "type": "PrimaryPersonListCollector", - "for_list": "people", - "add_or_edit_block": { - "id": "add-or-edit-primary-person", - "type": "PrimaryPersonListAddOrEditQuestion", - "question": { - "id": "primary-person-add-or-edit-question", - "type": "General", - "title": "What is your name?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "question": { - "id": "primary-confirmation-question", - "type": "General", - "title": "Do you live at 12 Lovely Villas?", - "answers": [ - { - "id": "you-live-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes, I usually live here", - "value": "Yes, I usually live here", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No, I don’t usually live here", - "value": "No, I don’t usually live here" - } - ] - } - ] - } - }, - { - "type": "ListCollectorDrivingQuestion", - "id": "anyone-usually-live-at", - "for_list": "people", - "question_variants": [ - { - "question": { - "id": "anyone-usually-live-at-question", - "title": "Do any of the following also usually live at 12 Lovely Villas on 21 March?", - "type": "MutuallyExclusive", - "mandatory": false, - "answers": [ - { - "type": "Checkbox", - "id": "anyone-usually-live-at-answer", - "mandatory": false, - "options": [ - { - "label": "Family Members and partners", - "value": "Family Members and partners", - "description": "Include babies born on or before 21 March, children, students and/or schoolchildren who live away during term time", - "action": { - "params": { - "block_id": "add-person", - "list_name": "people" - }, - "type": "RedirectToListAddBlock" - } - }, - { - "label": "Housemates, tenants or lodgers", - "value": "Housemates, tenants or lodgers", - "action": { - "params": { - "block_id": "add-person", - "list_name": "people" - }, - "type": "RedirectToListAddBlock" - } - } - ] - }, - { - "id": "anyone-usually-live-at-answer-exclusive", - "mandatory": false, - "options": [ - { - "label": "None of the these apply, I am the only person who usually lives here", - "value": "None of the these apply, I am the only person who usually lives here" - } - ], - "type": "Checkbox" - } - ] - }, - "when": { - "==": [ - { - "identifier": "you-live-here", - "source": "answers" - }, - "Yes, I usually live here" - ] - } - }, - { - "question": { - "id": "anyone-usually-live-at-question", - "title": "Do any of the following usually live at 12 Lovely Villas on 21 March?", - "type": "MutuallyExclusive", - "mandatory": false, - "answers": [ - { - "type": "Checkbox", - "id": "anyone-usually-live-at-answer", - "mandatory": false, - "options": [ - { - "label": "Family Members and partners", - "value": "Family Members and partners", - "description": "Include babies born on or before 21 March, children, students and/or schoolchildren who live away during term time", - "action": { - "params": { - "block_id": "add-person", - "list_name": "people" - }, - "type": "RedirectToListAddBlock" - } - }, - { - "label": "Housemates, tenants or lodgers", - "value": "Housemates, tenants or lodgers", - "action": { - "params": { - "block_id": "add-person", - "list_name": "people" - }, - "type": "RedirectToListAddBlock" - } - } - ] - }, - { - "id": "anyone-usually-live-at-answer-exclusive", - "mandatory": false, - "options": [ - { - "label": "None of these apply, no-one usually lives here", - "value": "None of these apply, no-one usually lives here" - } - ], - "type": "Checkbox" - } - ] - }, - "when": { - "==": [ - { - "identifier": "you-live-here", - "source": "answers" - }, - "No, I don’t usually live here" - ] - } - } - ], - "routing_rules": [ - { - "block": "list-collector-temporary-away-stay", - "when": { - "in": [ - "None of these apply, no-one usually lives here", - { - "identifier": "anyone-usually-live-at-answer-exclusive", - "source": "answers" - } - ] - } - }, - { - "block": "list-collector-temporary-away-stay", - "when": { - "in": [ - "None of the these apply, I am the only person who usually lives here", - { - "identifier": "anyone-usually-live-at-answer-exclusive", - "source": "answers" - } - ] - } - }, - { - "block": "list-collector" - } - ] - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes, I need to add a person", - "value": "Yes, I need to add a person", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No, I do not need to add a person", - "value": "No, I do not need to add a person" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question_variants": [ - { - "question": { - "id": "add-question", - "type": "General", - "title": "Who lives at 12 Lovely Villas?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - }, - "when": { - "==": [ - { - "source": "list", - "identifier": "people", - "selector": "count" - }, - 0 - ] - } - }, - { - "question": { - "id": "add-question", - "type": "General", - "title": "Who else lives at 12 Lovely Villas?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - }, - "when": { - ">": [ - { - "source": "list", - "identifier": "people", - "selector": "count" - }, - 0 - ] - } - } - ] - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": { - "text": "Change details for {first_name} {last_name}", - "placeholders": [ - { - "placeholder": "first_name", - "value": { - "source": "answers", - "identifier": "first-name" - } - }, - { - "placeholder": "last_name", - "value": { - "source": "answers", - "identifier": "last-name" - } - } - ] - }, - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "id": "list-collector-temporary-away-stay", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question-temporary-away-stay", - "type": "General", - "title": { - "text_plural": { - "forms": { - "one": "You said {number_of_people} person lives at 12 Lovely Villas. Do you need to add anyone?", - "other": "You said {number_of_people} people lives at 12 Lovely Villas. Do you need to add anyone?" - }, - "count": { - "source": "list", - "identifier": "people" - } - }, - "placeholders": [ - { - "placeholder": "number_of_people", - "value": { - "source": "list", - "identifier": "people", - "selector": "count" - } - } - ] - }, - "answers": [ - { - "id": "anyone-else-temporary-away-stay", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes, I need to add someone", - "value": "Yes, I need to add someone", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": { - "text_plural": { - "forms": { - "one": "No there is {number_of_people} person living here", - "other": "No there are {number_of_people} people living here" - }, - "count": { - "source": "list", - "identifier": "people" - } - }, - "placeholders": [ - { - "placeholder": "number_of_people", - "value": { - "source": "list", - "identifier": "people", - "selector": "count" - } - } - ] - }, - "value": "No there are {number_of_people} people living here" - } - ] - } - ] - }, - "add_block": { - "id": "add-person-temporary-away-stay", - "type": "ListAddQuestion", - "question_variants": [ - { - "question": { - "id": "add-question-temporary-away-stay", - "type": "General", - "title": "Who lives at 12 Lovely Villas?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - }, - "when": { - "==": [ - { - "source": "list", - "identifier": "people", - "selector": "count" - }, - 0 - ] - } - }, - { - "question": { - "id": "add-question-temporary-away-stay", - "type": "General", - "title": "Who else lives at 12 Lovely Villas?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - }, - "when": { - ">": [ - { - "source": "list", - "identifier": "people", - "selector": "count" - }, - 0 - ] - } - } - ] - }, - "edit_block": { - "id": "edit-person-temporary-away-stay", - "type": "ListEditQuestion", - "question": { - "id": "edit-question-temporary-away-stay", - "type": "General", - "title": { - "text": "Change details for {first_name} {last_name}", - "placeholders": [ - { - "placeholder": "first_name", - "value": { - "source": "answers", - "identifier": "first-name" - } - }, - { - "placeholder": "last_name", - "value": { - "source": "answers", - "identifier": "last-name" - } - } - ] - }, - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person-temporary-away-stay", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question-temporary-away-stay", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation-temporary-away-stay", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_list_collector_driving_question.json b/schemas/test/en/test_list_collector_driving_question.json deleted file mode 100644 index 9046699d67..0000000000 --- a/schemas/test/en/test_list_collector_driving_question.json +++ /dev/null @@ -1,251 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test ListCollectorDrivingQuestion", - "theme": "default", - "description": "A questionnaire to test ListCollectorDrivingQuestion", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section", - "title": "List Collector Driving Question Summary", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": "Household members", - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "type": "ListCollectorDrivingQuestion", - "id": "anyone-usually-live-at", - "for_list": "people", - "question": { - "type": "General", - "id": "anyone-usually-live-at-question", - "title": "Does anyone usually live at 1 Pleasant Lane?", - "guidance": { - "contents": [ - { - "title": "Outcomes", - "list": [ - "`None of the these apply, I am the only person who usually lives here` - Takes you directly to the list collector.", - "Any of the other checkboxes and the list is empty - Takes you to the list collector‘s add question.", - "Any of the other checkboxes and the list is not empty - Takes you directly to the list collector." - ] - } - ] - }, - "answers": [ - { - "type": "Radio", - "id": "anyone-usually-live-at-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-person", - "list_name": "people" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "section": "End", - "when": { - "==": [ - { - "source": "answers", - "identifier": "anyone-usually-live-at-answer" - }, - "No" - ] - } - }, - { - "block": "anyone-else-live-at" - } - ] - }, - { - "id": "anyone-else-live-at", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live at 1 Pleasant Lane?", - "answers": [ - { - "id": "anyone-else-live-at-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_list_collector_list_summary.json b/schemas/test/en/test_list_collector_list_summary.json deleted file mode 100644 index b07504fe6e..0000000000 --- a/schemas/test/en/test_list_collector_list_summary.json +++ /dev/null @@ -1,528 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test ListCollector", - "preview_questions": true, - "theme": "default", - "description": "A questionnaire to test ListCollector", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "display_address", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": {} - }, - "individual_response": { - "for_list": "people", - "individual_section_id": "section" - }, - "sections": [ - { - "id": "section", - "title": "People who live here and overnight visitors", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": { - "text": "Household members staying overnight on {date} at {household_address}", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "arguments": { - "date_format": "d MMMM yyyy", - "date_to_format": { - "value": "2019-10-13" - } - }, - "transform": "format_date" - } - ] - }, - { - "placeholder": "household_address", - "value": { - "identifier": "display_address", - "source": "metadata" - } - } - ] - }, - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - }, - { - "type": "List", - "for_list": "visitors", - "title": { - "text": "Visitors staying overnight on {date} at {household_address}", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "arguments": { - "date_format": "d MMMM yyyy", - "date_to_format": { - "value": "2019-10-13" - } - }, - "transform": "format_date" - } - ] - }, - { - "placeholder": "household_address", - "value": { - "identifier": "display_address", - "source": "metadata" - } - } - ] - }, - "add_link_text": "Add another visitor to this household", - "empty_list_text": "There are no visitors" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "Questions", - "blocks": [ - { - "id": "introduction", - "type": "Introduction" - }, - { - "id": "primary-person-list-collector", - "type": "PrimaryPersonListCollector", - "for_list": "people", - "add_or_edit_block": { - "id": "add-or-edit-primary-person", - "type": "PrimaryPersonListAddOrEditQuestion", - "question": { - "id": "primary-person-add-or-edit-question", - "type": "General", - "title": "What is your name?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "question": { - "id": "primary-confirmation-question", - "type": "General", - "title": { - "placeholders": [ - { - "placeholder": "household_address", - "value": { - "identifier": "display_address", - "source": "metadata" - } - } - ], - "text": "Do you live at {household_address}?" - }, - "answers": [ - { - "id": "you-live-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": { - "placeholders": [ - { - "placeholder": "household_address", - "value": { - "identifier": "display_address", - "source": "metadata" - } - } - ], - "text": "Does anyone else live at {household_address}?" - }, - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": { - "text": "Household members staying overnight on {date} at {household_address}", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "arguments": { - "date_format": "d MMMM yyyy", - "date_to_format": { - "value": "2019-10-13" - } - }, - "transform": "format_date" - } - ] - }, - { - "placeholder": "household_address", - "value": { - "identifier": "display_address", - "source": "metadata" - } - } - ] - }, - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "id": "visitor-list-collector", - "type": "ListCollector", - "for_list": "visitors", - "question": { - "id": "confirmation-visitor-question", - "type": "General", - "title": { - "placeholders": [ - { - "placeholder": "household_address", - "value": { - "identifier": "display_address", - "source": "metadata" - } - } - ], - "text": "Are there any other visitors staying overnight at {household_address}?" - }, - "answers": [ - { - "id": "any-more-visitors", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-visitor", - "type": "ListAddQuestion", - "question": { - "id": "add-visitor-question", - "type": "General", - "title": "What is the name of the visitor?", - "answers": [ - { - "id": "first-name-visitor", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name-visitor", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-visitor-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-visitor-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name-visitor", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name-visitor", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-visitor", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-visitor-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-visitor-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": { - "text": "Visitors staying overnight on {date} at {household_address}", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "arguments": { - "date_format": "d MMMM yyyy", - "date_to_format": { - "value": "2019-10-13" - } - }, - "transform": "format_date" - } - ] - }, - { - "placeholder": "household_address", - "value": { - "identifier": "display_address", - "source": "metadata" - } - } - ] - }, - "item_title": { - "text": "{visitor_name}", - "placeholders": [ - { - "placeholder": "visitor_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name-visitor" - }, - { - "source": "answers", - "identifier": "last-name-visitor" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_list_collector_primary_and_collector_with_driving_question.json b/schemas/test/en/test_list_collector_primary_and_collector_with_driving_question.json deleted file mode 100644 index 5b47d6e0d5..0000000000 --- a/schemas/test/en/test_list_collector_primary_and_collector_with_driving_question.json +++ /dev/null @@ -1,304 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test ListCollectorPrimaryAndCollectorWithDrivingQuestion", - "theme": "default", - "description": "A questionnaire to test ListCollectorPrimaryAndCollectorWithDrivingQuestion", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section", - "title": "List Collector Primary And Collector With Driving Question Summary", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": "Household members", - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "primary-person-list-collector", - "type": "PrimaryPersonListCollector", - "for_list": "people", - "add_or_edit_block": { - "id": "add-or-edit-primary-person", - "type": "PrimaryPersonListAddOrEditQuestion", - "question": { - "id": "primary-person-add-or-edit-question", - "type": "General", - "title": "What is your name", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "question": { - "id": "primary-confirmation-question", - "type": "General", - "title": "Do you live here?", - "answers": [ - { - "id": "you-live-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "type": "ListCollectorDrivingQuestion", - "id": "anyone-else-usually-live-at", - "for_list": "people", - "question": { - "type": "General", - "id": "anyone-else-usually-live-at-question", - "title": "Does anyone else usually live at 1 Pleasant Lane?", - "guidance": { - "contents": [ - { - "title": "Outcomes", - "list": [ - "`None of the these apply, I am the only person who usually lives here` - Takes you directly to the list collector.", - "Any of the other checkboxes and the list is empty - Takes you to the list collector‘s add question.", - "Any of the other checkboxes and the list is not empty - Takes you directly to the list collector." - ] - } - ] - }, - "answers": [ - { - "type": "Radio", - "id": "anyone-else-usually-live-at-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-person", - "list_name": "people" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "section": "End", - "when": { - "==": [ - { - "source": "answers", - "identifier": "anyone-else-usually-live-at-answer" - }, - "No" - ] - } - }, - { - "block": "anyone-else-live-at" - } - ] - }, - { - "id": "anyone-else-live-at", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live at 1 Pleasant Lane?", - "answers": [ - { - "id": "anyone-else-live-at-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_list_collector_primary_person.json b/schemas/test/en/test_list_collector_primary_person.json deleted file mode 100644 index 1ada4c69aa..0000000000 --- a/schemas/test/en/test_list_collector_primary_person.json +++ /dev/null @@ -1,341 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test PrimaryPersonListCollector", - "theme": "default", - "description": "A questionnaire to test Primary Person ListCollector", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": {} - }, - "submission": { - "button": "Submit answers", - "guidance": "Thank you for your answers, do you wish to submit", - "title": "Submit answers", - "warning": "You cannot view your answers after submission" - }, - "sections": [ - { - "id": "section", - "title": "Household members", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": "Household members", - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "Primary Person", - "blocks": [ - { - "id": "primary-person-list-collector", - "type": "PrimaryPersonListCollector", - "for_list": "people", - "add_or_edit_block": { - "id": "add-or-edit-primary-person", - "type": "PrimaryPersonListAddOrEditQuestion", - "question": { - "id": "primary-person-add-or-edit-question", - "type": "General", - "title": "What is your name", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "question": { - "id": "primary-confirmation-question", - "type": "General", - "title": "Do you live here?", - "answers": [ - { - "id": "you-live-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "id": "anyone-usually-live-at", - "question": { - "answers": [ - { - "id": "anyone-usually-live-at-answer", - "mandatory": true, - "options": [ - { - "action": { - "params": { - "block_id": "add-person", - "list_name": "people" - }, - "type": "RedirectToListAddBlock" - }, - "label": "Yes", - "value": "Yes" - }, - { - "description": "For example, this is a second address or holiday home", - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "anyone-usually-live-at-question", - "title": "Does anyone else live at your address?", - "type": "General" - }, - "routing_rules": [ - { - "section": "End", - "when": { - "and": [ - { - "==": [ - { - "source": "answers", - "identifier": "anyone-usually-live-at-answer" - }, - "No" - ] - }, - { - "<": [ - { - "source": "list", - "identifier": "people", - "selector": "count" - }, - 1 - ] - } - ] - } - }, - { - "block": "list-collector" - } - ], - "skip_conditions": { - "when": { - "==": [ - { - "source": "answers", - "identifier": "you-live-here" - }, - "Yes" - ] - } - }, - "type": "Question" - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": { - "text": "Change details for {first_name} {last_name}", - "placeholders": [ - { - "placeholder": "first_name", - "value": { - "source": "answers", - "identifier": "first-name" - } - }, - { - "placeholder": "last_name", - "value": { - "source": "answers", - "identifier": "last-name" - } - } - ] - }, - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_list_collector_repeating_blocks_section_summary.json b/schemas/test/en/test_list_collector_repeating_blocks_section_summary.json deleted file mode 100644 index c43fe8b93e..0000000000 --- a/schemas/test/en/test_list_collector_repeating_blocks_section_summary.json +++ /dev/null @@ -1,432 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test a List Collector with Repeating Blocks and Section Summary Items", - "theme": "default", - "description": "A questionnaire to test a list collector with repeating blocks and section summary items", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "answer_codes": [ - { - "answer_id": "responsible-party-answer", - "code": "1" - }, - { - "answer_id": "any-companies-or-branches-answer", - "code": "2" - }, - { - "answer_id": "company-or-branch-name", - "code": "2a" - }, - { - "answer_id": "registration-number", - "code": "2b" - }, - { - "answer_id": "registration-date", - "code": "2c" - }, - { - "answer_id": "authorised-trader-uk-radio", - "code": "2d" - }, - { - "answer_id": "authorised-trader-eu-radio", - "code": "2e" - }, - { - "answer_id": "any-other-companies-or-branches-answer", - "code": "3" - }, - { - "answer_id": "any-other-trading-details-answer", - "code": "4" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section-companies", - "title": "General insurance business", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "companies", - "title": "Companies or UK branches", - "item_anchor_answer_id": "company-or-branch-name", - "item_label": "Name of UK company or branch", - "add_link_text": "Add another UK company or branch", - "empty_list_text": "No UK company or branch added" - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "group-companies", - "blocks": [ - { - "type": "Question", - "id": "responsible-party", - "question": { - "type": "General", - "id": "responsible-party-question", - "title": "Are you the responsible party for reporting trading details for a company of branch?", - "answers": [ - { - "type": "Radio", - "id": "responsible-party-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "any-companies-or-branches", - "when": { - "==": [ - "Yes", - { - "source": "answers", - "identifier": "responsible-party-answer" - } - ] - } - }, - { - "section": "End" - } - ] - }, - { - "type": "ListCollectorDrivingQuestion", - "id": "any-companies-or-branches", - "for_list": "companies", - "question": { - "type": "General", - "id": "any-companies-or-branches-question", - "title": "Do any companies or branches within your United Kingdom group undertake general insurance business?", - "answers": [ - { - "type": "Radio", - "id": "any-companies-or-branches-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-company", - "list_name": "companies" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "when": { - "==": [ - { - "source": "answers", - "identifier": "any-companies-or-branches-answer" - }, - "Yes" - ] - }, - "block": "any-other-companies-or-branches" - }, - { - "section": "End" - } - ] - }, - { - "id": "any-other-companies-or-branches", - "type": "ListCollector", - "for_list": "companies", - "question": { - "id": "any-other-companies-or-branches-question", - "type": "General", - "title": "Do you need to add any other UK companies or branches that undertake general insurance business?", - "answers": [ - { - "id": "any-other-companies-or-branches-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-company", - "type": "ListAddQuestion", - "question": { - "id": "add-question-companies", - "type": "General", - "title": "What is the name and registration number of the company?", - "answers": [ - { - "id": "company-or-branch-name", - "label": "Name of UK company or branch (Mandatory)", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "repeating_blocks": [ - { - "id": "companies-repeating-block-1", - "type": "ListRepeatingQuestion", - "question": { - "id": "companies-repeating-block-1-question", - "type": "General", - "title": { - "text": "Give details about {company_name}", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "answers", - "identifier": "company-or-branch-name" - } - } - ] - }, - "answers": [ - { - "id": "registration-number", - "label": "Registration number (Mandatory)", - "mandatory": true, - "type": "Number", - "maximum": { - "value": 999, - "exclusive": false - }, - "decimal_places": 0 - }, - { - "id": "registration-date", - "label": "Date of Registration (Mandatory)", - "mandatory": true, - "type": "Date", - "maximum": { - "value": "now" - } - } - ] - } - }, - { - "id": "companies-repeating-block-2", - "type": "ListRepeatingQuestion", - "question": { - "id": "companies-repeating-block-2-question", - "type": "General", - "title": { - "text": "Give details about how {company_name} has been trading over the past {date_difference}.", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "answers", - "identifier": "company-or-branch-name" - } - }, - { - "placeholder": "date_difference", - "transforms": [ - { - "transform": "calculate_date_difference", - "arguments": { - "first_date": { - "source": "answers", - "identifier": "registration-date" - }, - "second_date": { - "value": "now" - } - } - } - ] - } - ] - }, - "answers": [ - { - "type": "Radio", - "label": "Has this company been trading in the UK? (Mandatory)", - "id": "authorised-trader-uk-radio", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - }, - { - "type": "Radio", - "label": "Has this company been trading in the EU? (Not mandatory)", - "id": "authorised-trader-eu-radio", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - } - ], - "edit_block": { - "id": "edit-company", - "type": "ListEditQuestion", - "question": { - "id": "edit-question-companies", - "type": "General", - "title": "What is the name and registration number of the company?", - "answers": [ - { - "id": "company-or-branch-name", - "label": "Name of UK company or branch (Mandatory)", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-company", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question-companies", - "type": "General", - "title": "Are you sure you want to remove this company or UK branch?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Companies or UK branches", - "item_title": { - "text": "{company_name}", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "answers", - "identifier": "company-or-branch-name" - } - } - ] - } - } - }, - { - "id": "any-other-trading-details", - "type": "Question", - "question": { - "id": "any-other-trading-details-question", - "type": "General", - "title": "Do you have any other details about the trading you have reported for?", - "answers": [ - { - "id": "any-other-trading-details-answer", - "label": "Additional details", - "mandatory": false, - "type": "TextField" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_list_collector_repeating_blocks_with_hub.json b/schemas/test/en/test_list_collector_repeating_blocks_with_hub.json deleted file mode 100644 index 9eff68c1a7..0000000000 --- a/schemas/test/en/test_list_collector_repeating_blocks_with_hub.json +++ /dev/null @@ -1,826 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test a List Collector with Repeating Blocks and Section Summary Items", - "theme": "default", - "description": "A questionnaire to test a list collector with repeating blocks and section summary items", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "answer_codes": [ - { - "answer_id": "responsible-party-answer", - "code": "1" - }, - { - "answer_id": "any-companies-or-branches-answer", - "code": "2" - }, - { - "answer_id": "company-or-branch-name", - "code": "2a" - }, - { - "answer_id": "registration-number", - "code": "2b" - }, - { - "answer_id": "registration-date", - "code": "2c" - }, - { - "answer_id": "authorised-trader-uk-radio", - "code": "2d" - }, - { - "answer_id": "authorised-trader-eu-radio", - "code": "2e" - }, - { - "answer_id": "any-other-companies-or-branches-answer", - "code": "3" - }, - { - "answer_id": "any-other-trading-details-answer", - "code": "4" - }, - { - "answer_id": "responsible-party-business-answer", - "code": "5" - }, - { - "answer_id": "any-businesses-or-branches-answer", - "code": "6" - }, - { - "answer_id": "business-or-branch-name", - "code": "6a" - }, - { - "answer_id": "registration-business-number", - "code": "6b" - }, - { - "answer_id": "registration-business-date", - "code": "6c" - }, - { - "answer_id": "authorised-business-trader-uk-radio", - "code": "6d" - }, - { - "answer_id": "authorised-business-trader-eu-radio", - "code": "6e" - }, - { - "answer_id": "any-other-business-businesses-or-branches-answer", - "code": "7" - }, - { - "answer_id": "any-other-business-trading-details-answer", - "code": "8" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { - "required_completed_sections": ["section-companies"] - } - }, - "sections": [ - { - "id": "section-companies", - "title": "General insurance companies", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "companies", - "title": "Companies or UK branches", - "item_anchor_answer_id": "company-or-branch-name", - "item_label": "Name of UK company or branch", - "add_link_text": "Add another UK company or branch", - "empty_list_text": "No UK company or branch added" - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "group-companies", - "blocks": [ - { - "type": "Question", - "id": "responsible-party", - "question": { - "type": "General", - "id": "responsible-party-question", - "title": "Are you the responsible party for reporting trading details for a company of branch?", - "answers": [ - { - "type": "Radio", - "id": "responsible-party-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "any-companies-or-branches", - "when": { - "==": [ - "Yes", - { - "source": "answers", - "identifier": "responsible-party-answer" - } - ] - } - }, - { - "section": "End" - } - ] - }, - { - "type": "ListCollectorDrivingQuestion", - "id": "any-companies-or-branches", - "for_list": "companies", - "question": { - "type": "General", - "id": "any-companies-or-branches-question", - "title": "Do any companies or branches within your United Kingdom group undertake general insurance business?", - "answers": [ - { - "type": "Radio", - "id": "any-companies-or-branches-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-company", - "list_name": "companies" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "when": { - "==": [ - { - "source": "answers", - "identifier": "any-companies-or-branches-answer" - }, - "Yes" - ] - }, - "block": "any-other-companies-or-branches" - }, - { - "section": "End" - } - ] - }, - { - "id": "any-other-companies-or-branches", - "type": "ListCollector", - "for_list": "companies", - "question": { - "id": "any-other-companies-or-branches-question", - "type": "General", - "title": "Do you need to add any other UK companies or branches that undertake general insurance business?", - "answers": [ - { - "id": "any-other-companies-or-branches-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-company", - "type": "ListAddQuestion", - "question": { - "id": "add-question-companies", - "type": "General", - "title": "What is the name and registration number of the company?", - "answers": [ - { - "id": "company-or-branch-name", - "label": "Name of UK company or branch (Mandatory)", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "repeating_blocks": [ - { - "id": "companies-repeating-block-1", - "type": "ListRepeatingQuestion", - "question": { - "id": "companies-repeating-block-1-question", - "type": "General", - "title": { - "text": "Give details about {company_name}", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "answers", - "identifier": "company-or-branch-name" - } - } - ] - }, - "answers": [ - { - "id": "registration-number", - "label": "Registration number (Mandatory)", - "mandatory": true, - "type": "Number", - "maximum": { - "value": 999, - "exclusive": false - }, - "decimal_places": 0 - }, - { - "id": "registration-date", - "label": "Date of Registration (Mandatory)", - "mandatory": true, - "type": "Date", - "maximum": { - "value": "now" - } - } - ] - } - }, - { - "id": "companies-repeating-block-2", - "type": "ListRepeatingQuestion", - "question": { - "id": "companies-repeating-block-2-question", - "type": "General", - "title": { - "text": "Give details about how {company_name} has been trading over the past {date_difference}.", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "answers", - "identifier": "company-or-branch-name" - } - }, - { - "placeholder": "date_difference", - "transforms": [ - { - "transform": "calculate_date_difference", - "arguments": { - "first_date": { - "source": "answers", - "identifier": "registration-date" - }, - "second_date": { - "value": "now" - } - } - } - ] - } - ] - }, - "answers": [ - { - "type": "Radio", - "label": "Has this company been trading in the UK? (Mandatory)", - "id": "authorised-trader-uk-radio", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - }, - { - "type": "Radio", - "label": "Has this company been trading in the EU? (Not mandatory)", - "id": "authorised-trader-eu-radio", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - } - ], - "edit_block": { - "id": "edit-company", - "type": "ListEditQuestion", - "question": { - "id": "edit-question-companies", - "type": "General", - "title": "What is the name and registration number of the company?", - "answers": [ - { - "id": "company-or-branch-name", - "label": "Name of UK company or branch (Mandatory)", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-company", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question-companies", - "type": "General", - "title": "Are you sure you want to remove this company or UK branch?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Companies or UK branches", - "item_title": { - "text": "{company_name}", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "answers", - "identifier": "company-or-branch-name" - } - } - ] - } - } - }, - { - "id": "any-other-trading-details", - "type": "Question", - "question": { - "id": "any-other-trading-details-question", - "type": "General", - "title": "Do you have any other details about the trading you have reported for?", - "answers": [ - { - "id": "any-other-trading-details-answer", - "label": "Additional details", - "mandatory": false, - "type": "TextField" - } - ] - } - } - ] - } - ] - }, - { - "id": "section-businesses", - "title": "General insurance business", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "businesses", - "title": "Businesses or UK branches", - "item_anchor_answer_id": "business-or-branch-name", - "item_label": "Name of UK business or branch", - "add_link_text": "Add another UK business or branch", - "empty_list_text": "No UK business or branch added" - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "group-businesses", - "blocks": [ - { - "type": "Question", - "id": "responsible-party-business", - "question": { - "type": "General", - "id": "responsible-party-business-question", - "title": "Are you the responsible party for reporting trading details for a business of branch?", - "answers": [ - { - "type": "Radio", - "id": "responsible-party-business-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "any-businesses-or-branches", - "when": { - "==": [ - "Yes", - { - "source": "answers", - "identifier": "responsible-party-business-answer" - } - ] - } - }, - { - "section": "End" - } - ] - }, - { - "type": "ListCollectorDrivingQuestion", - "id": "any-businesses-or-branches", - "for_list": "businesses", - "question": { - "type": "General", - "id": "any-businesses-or-branches-question", - "title": "Do any businesses or branches within your United Kingdom group undertake general insurance business?", - "answers": [ - { - "type": "Radio", - "id": "any-businesses-or-branches-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-business", - "list_name": "businesses" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "when": { - "==": [ - { - "source": "answers", - "identifier": "any-businesses-or-branches-answer" - }, - "Yes" - ] - }, - "block": "any-other-business-businesses-or-branches" - }, - { - "section": "End" - } - ] - }, - { - "id": "any-other-business-businesses-or-branches", - "type": "ListCollector", - "for_list": "businesses", - "question": { - "id": "any-other-business-businesses-or-branches-question", - "type": "General", - "title": "Do you need to add any other UK businesses or branches that undertake general insurance business?", - "answers": [ - { - "id": "any-other-business-businesses-or-branches-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-business", - "type": "ListAddQuestion", - "question": { - "id": "add-question-businesses", - "type": "General", - "title": "What is the name and registration number of the business?", - "answers": [ - { - "id": "business-or-branch-name", - "label": "Name of UK business or branch (Mandatory)", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "repeating_blocks": [ - { - "id": "businesses-repeating-block-1", - "type": "ListRepeatingQuestion", - "question": { - "id": "businesses-repeating-block-1-question", - "type": "General", - "title": { - "text": "Give details about {business_name}", - "placeholders": [ - { - "placeholder": "business_name", - "value": { - "source": "answers", - "identifier": "business-or-branch-name" - } - } - ] - }, - "answers": [ - { - "id": "registration-business-number", - "label": "Registration number (Mandatory)", - "mandatory": true, - "type": "Number", - "maximum": { - "value": 999, - "exclusive": false - }, - "decimal_places": 0 - }, - { - "id": "registration-business-date", - "label": "Date of Registration (Mandatory)", - "mandatory": true, - "type": "Date", - "maximum": { - "value": "now" - } - } - ] - } - }, - { - "id": "businesses-repeating-block-2", - "type": "ListRepeatingQuestion", - "question": { - "id": "businesses-repeating-block-2-question", - "type": "General", - "title": { - "text": "Give details about how {business_name} has been trading over the past {date_difference}.", - "placeholders": [ - { - "placeholder": "business_name", - "value": { - "source": "answers", - "identifier": "business-or-branch-name" - } - }, - { - "placeholder": "date_difference", - "transforms": [ - { - "transform": "calculate_date_difference", - "arguments": { - "first_date": { - "source": "answers", - "identifier": "registration-business-date" - }, - "second_date": { - "value": "now" - } - } - } - ] - } - ] - }, - "answers": [ - { - "type": "Radio", - "label": "Has this business been trading in the UK? (Mandatory)", - "id": "authorised-business-trader-uk-radio", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - }, - { - "type": "Radio", - "label": "Has this business been trading in the EU? (Not mandatory)", - "id": "authorised-business-trader-eu-radio", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - } - ], - "edit_block": { - "id": "edit-business", - "type": "ListEditQuestion", - "question": { - "id": "edit-question-businesses", - "type": "General", - "title": "What is the name and registration number of the business?", - "answers": [ - { - "id": "business-or-branch-name", - "label": "Name of UK business or branch (Mandatory)", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-business", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question-businesses", - "type": "General", - "title": "Are you sure you want to remove this business or UK branch?", - "answers": [ - { - "id": "remove-confirmation-business", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Businesses or UK branches", - "item_title": { - "text": "{business_name}", - "placeholders": [ - { - "placeholder": "business_name", - "value": { - "source": "answers", - "identifier": "business-or-branch-name" - } - } - ] - } - } - }, - { - "id": "any-other-business-trading-details", - "type": "Question", - "question": { - "id": "any-other-business-trading-details-question", - "type": "General", - "title": "Do you have any other details about the trading you have reported for?", - "answers": [ - { - "id": "any-other-business-trading-details-answer", - "label": "Additional details", - "mandatory": false, - "type": "TextField" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_list_collector_same_name_items.json b/schemas/test/en/test_list_collector_same_name_items.json deleted file mode 100644 index 18109e2242..0000000000 --- a/schemas/test/en/test_list_collector_same_name_items.json +++ /dev/null @@ -1,394 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Same Name items", - "theme": "default", - "description": "A questionnaire to test ListCollectors where names may be the same", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": {} - }, - "sections": [ - { - "id": "section", - "title": "Household members", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": "Household members", - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "Primary Person", - "blocks": [ - { - "id": "primary-person-list-collector", - "type": "PrimaryPersonListCollector", - "for_list": "people", - "same_name_answer_ids": ["first-name", "last-name"], - "add_or_edit_block": { - "id": "add-or-edit-primary-person", - "type": "PrimaryPersonListAddOrEditQuestion", - "question": { - "id": "primary-person-add-or-edit-question", - "type": "General", - "title": "What is your name", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "middle-names", - "label": "Middle names", - "mandatory": false, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "question": { - "id": "primary-confirmation-question", - "type": "General", - "title": "Do you live here?", - "answers": [ - { - "id": "you-live-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "id": "anyone-usually-live-at", - "question": { - "answers": [ - { - "id": "anyone-usually-live-at-answer", - "mandatory": true, - "options": [ - { - "action": { - "params": { - "block_id": "add-person", - "list_name": "people" - }, - "type": "RedirectToListAddBlock" - }, - "label": "Yes", - "value": "Yes" - }, - { - "description": "For example, this is a second address or holiday home", - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "anyone-usually-live-at-question", - "title": "Does anyone else live at your address?", - "type": "General" - }, - "routing_rules": [ - { - "section": "End", - "when": { - "and": [ - { - "==": [ - { - "identifier": "anyone-usually-live-at-answer", - "source": "answers" - }, - "No" - ] - }, - { - "<": [ - { - "source": "list", - "identifier": "people", - "selector": "count" - }, - 1 - ] - } - ] - } - }, - { - "block": "list-collector" - } - ], - "skip_conditions": { - "when": { - "==": [ - { - "source": "answers", - "identifier": "you-live-here" - }, - "Yes" - ] - } - }, - "type": "Question" - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "same_name_answer_ids": ["first-name", "last-name"], - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "middle-names", - "label": "Middle names", - "mandatory": false, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": { - "text": "Change details for {person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "contains", - "arguments": { - "list_to_check": { - "source": "list", - "selector": "same_name_items", - "identifier": "people" - }, - "value": { - "source": "location", - "identifier": "list_item_id" - } - } - }, - { - "transform": "format_name", - "arguments": { - "include_middle_names": { - "source": "previous_transform" - }, - "first_name": { - "source": "answers", - "identifier": "first-name" - }, - "middle_names": { - "source": "answers", - "identifier": "middle-names" - }, - "last_name": { - "source": "answers", - "identifier": "last-name" - } - } - } - ] - } - ] - }, - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "middle-names", - "label": "Middle names", - "mandatory": false, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "list_has_items", - "arguments": { - "list_to_check": { - "source": "list", - "selector": "same_name_items", - "identifier": "people" - } - } - }, - { - "transform": "format_name", - "arguments": { - "include_middle_names": { - "source": "previous_transform" - }, - "first_name": { - "source": "answers", - "identifier": "first-name" - }, - "middle_names": { - "source": "answers", - "identifier": "middle-names" - }, - "last_name": { - "source": "answers", - "identifier": "last-name" - } - } - } - ] - } - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_list_collector_section_summary.json b/schemas/test/en/test_list_collector_section_summary.json deleted file mode 100644 index f739e7583d..0000000000 --- a/schemas/test/en/test_list_collector_section_summary.json +++ /dev/null @@ -1,549 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test List Collector Section Summary Items", - "theme": "default", - "description": "A questionnaire to test list collector section summary items", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "post_submission": { - "view_response": true - }, - "answer_codes": [ - { - "answer_id": "any-companies-or-branches-answer", - "code": "1" - }, - { - "answer_id": "company-or-branch-name", - "code": "1a" - }, - { - "answer_id": "registration-number", - "code": "1b" - }, - { - "answer_id": "authorised-insurer-radio", - "code": "1c" - }, - { - "answer_id": "any-other-companies-or-branches-answer", - "code": "2" - }, - { - "answer_id": "confirmation-checkbox-answer", - "code": "3" - }, - { - "answer_id": "anyone-else", - "code": "4" - }, - { - "answer_id": "householder-checkbox-answer", - "code": "5" - }, - { - "answer_id": "first-name", - "code": "6" - }, - { - "answer_id": "last-name", - "code": "7" - } - ], - "sections": [ - { - "id": "section-companies", - "title": "General insurance business", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "companies", - "title": "Companies or UK branches", - "item_anchor_answer_id": "company-or-branch-name", - "item_label": "Name of UK company or branch", - "add_link_text": "Add another UK company or branch", - "empty_list_text": "No UK company or branch added", - "related_answers": [ - { - "source": "answers", - "identifier": "registration-number" - }, - { - "source": "answers", - "identifier": "authorised-insurer-radio" - } - ] - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "group-companies", - "blocks": [ - { - "type": "ListCollectorDrivingQuestion", - "id": "any-companies-or-branches", - "for_list": "companies", - "question": { - "type": "General", - "id": "any-companies-or-branches-question", - "title": "Do any companies or branches within your United Kingdom group undertake general insurance business?", - "answers": [ - { - "type": "Radio", - "id": "any-companies-or-branches-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-company", - "list_name": "companies" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "when": { - "==": [{ "source": "answers", "identifier": "any-companies-or-branches-answer" }, "No"] - }, - "block": "confirmation-checkbox" - }, - { - "block": "any-other-companies-or-branches" - } - ] - }, - { - "id": "any-other-companies-or-branches", - "type": "ListCollector", - "for_list": "companies", - "question": { - "id": "any-other-companies-or-branches-question", - "type": "General", - "title": "Do you need to add any other UK companies or branches that undertake general insurance business?", - "answers": [ - { - "id": "any-other-companies-or-branches-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-company", - "type": "ListAddQuestion", - "question": { - "id": "add-question-companies", - "type": "General", - "title": "Give details about the company or branch that undertakes general insurance business", - "answers": [ - { - "id": "company-or-branch-name", - "label": "Name of UK company or branch", - "mandatory": true, - "type": "TextField" - }, - { - "id": "registration-number", - "label": "Registration number", - "mandatory": true, - "type": "Number", - "maximum": { - "value": 999, - "exclusive": false - }, - "decimal_places": 0 - }, - { - "type": "Radio", - "label": "Is this UK company or branch an authorised insurer?", - "id": "authorised-insurer-radio", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "edit_block": { - "id": "edit-company", - "type": "ListEditQuestion", - "question": { - "id": "edit-question-companies", - "type": "General", - "title": "What is the name of the company?", - "answers": [ - { - "id": "company-or-branch-name", - "label": "Name of UK company or branch", - "mandatory": true, - "type": "TextField" - }, - { - "id": "registration-number", - "label": "Registration number", - "mandatory": true, - "type": "Number" - }, - { - "type": "Radio", - "label": "Is this UK company or branch an authorised insurer?", - "id": "authorised-insurer-radio", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "remove_block": { - "id": "remove-company", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question-companies", - "type": "General", - "title": "Are you sure you want to remove this company or UK branch?", - "answers": [ - { - "id": "remove-confirmation-company", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Companies or UK branches", - "item_title": { - "text": "{company_name}", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "answers", - "identifier": "company-or-branch-name" - } - } - ] - } - } - }, - { - "type": "Question", - "id": "confirmation-checkbox", - "question": { - "answers": [ - { - "id": "confirmation-checkbox-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "confirmation-checkbox-question", - "title": "Are all companies or branches based in UK?", - "type": "General" - }, - "skip_conditions": { - "when": { - "!=": [ - { - "count": [ - { - "source": "list", - "identifier": "companies" - } - ] - }, - 3 - ] - } - } - } - ] - } - ] - }, - { - "id": "section-household", - "title": "Household Section", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": "Who lives here", - "item_anchor_answer_id": "first-name", - "item_label": "Name of householder", - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "group-household", - "title": "Household Questions", - "blocks": [ - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "cancel_text": "Don’t need to add anyone else?", - "question": { - "id": "add-question-people", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "cancel_text": "Don’t need to change anything?", - "question": { - "id": "edit-question-people", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "cancel_text": "Don’t need to remove this person?", - "question": { - "id": "remove-question-people", - "type": "General", - "title": "Are you sure you want to remove this person?", - "warning": "All of the information about this person will be deleted", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "type": "Question", - "id": "householder-checkbox", - "question": { - "answers": [ - { - "id": "householder-checkbox-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "householder-checkbox-question", - "title": "Are all these people based in the UK?", - "type": "General" - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_list_collector_two_list_collectors.json b/schemas/test/en/test_list_collector_two_list_collectors.json deleted file mode 100644 index 8f6c798d43..0000000000 --- a/schemas/test/en/test_list_collector_two_list_collectors.json +++ /dev/null @@ -1,436 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test PrimaryAndTwoListCollectors", - "theme": "default", - "description": "A questionnaire to test Primary Person ListCollector and two ListCollectors", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": {} - }, - "sections": [ - { - "id": "section", - "title": "Household members", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": "Household members", - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "People", - "blocks": [ - { - "type": "ListCollectorDrivingQuestion", - "id": "anyone-usually-live-at", - "for_list": "people", - "question": { - "type": "General", - "id": "anyone-usually-live-at-question", - "title": "Does anyone live at your address?", - "answers": [ - { - "type": "Radio", - "id": "anyone-usually-live-at-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-person", - "list_name": "people" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "list-collector" - } - ] - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": { - "text": "Change details for {first_name} {last_name}", - "placeholders": [ - { - "placeholder": "first_name", - "value": { - "source": "answers", - "identifier": "first-name" - } - }, - { - "placeholder": "last_name", - "value": { - "source": "answers", - "identifier": "last-name" - } - } - ] - }, - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "id": "another-anyone-usually-live-at", - "question": { - "answers": [ - { - "id": "another-anyone-usually-live-at-answer", - "mandatory": true, - "options": [ - { - "action": { - "params": { - "block_id": "another-add-person", - "list_name": "people" - }, - "type": "RedirectToListAddBlock" - }, - "label": "Yes", - "value": "Yes" - }, - { - "description": "For example, this is a second address or holiday home", - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "another-anyone-usually-live-at-question", - "title": "Does anyone else live at your address?", - "type": "General" - }, - "routing_rules": [ - { - "block": "another-list-collector" - } - ], - "type": "Question" - }, - { - "id": "another-list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "another-confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "another-anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "another-add-person", - "type": "ListAddQuestion", - "question": { - "id": "another-add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "another-edit-person", - "type": "ListEditQuestion", - "question": { - "id": "another-edit-question", - "type": "General", - "title": { - "text": "Change details for {first_name} {last_name}", - "placeholders": [ - { - "placeholder": "first_name", - "value": { - "source": "answers", - "identifier": "first-name" - } - }, - { - "placeholder": "last_name", - "value": { - "source": "answers", - "identifier": "last-name" - } - } - ] - }, - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "another-remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "another-remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "another-remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_list_collector_variants.json b/schemas/test/en/test_list_collector_variants.json deleted file mode 100644 index 44d1975b70..0000000000 --- a/schemas/test/en/test_list_collector_variants.json +++ /dev/null @@ -1,385 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test ListCollector", - "theme": "default", - "description": "A questionnaire to test ListCollector", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": {} - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "type": "Question", - "id": "you-live-here-block", - "question": { - "type": "General", - "id": "you-live-here-question", - "title": "Do you live at 1 Pleasant Lane?", - "answers": [ - { - "type": "Radio", - "id": "you-live-here-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question_variants": [ - { - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live at 1 Pleasant Lane?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "you-live-here-answer" - }, - "Yes" - ] - } - }, - { - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone live at 1 Pleasant Lane?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "you-live-here-answer" - }, - "No" - ] - } - } - ], - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question_variants": [ - { - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person who isn’t you?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "you-live-here-answer" - }, - "No" - ] - } - }, - { - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "you-live-here-answer" - }, - "Yes" - ] - } - } - ] - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question_variants": [ - { - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "you-live-here-answer" - }, - "Yes" - ] - } - }, - { - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person who isn’t you?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "you-live-here-answer" - }, - "No" - ] - } - } - ] - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question_variants": [ - { - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "you-live-here-answer" - }, - "Yes" - ] - } - }, - { - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person who isn’t you?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "you-live-here-answer" - }, - "No" - ] - } - } - ] - }, - "summary": { - "title": "People who live here", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_list_collector_variants_primary_person.json b/schemas/test/en/test_list_collector_variants_primary_person.json deleted file mode 100644 index d4b7246a6d..0000000000 --- a/schemas/test/en/test_list_collector_variants_primary_person.json +++ /dev/null @@ -1,368 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test PrimaryPersonListCollector With Variants", - "theme": "default", - "description": "A questionnaire to test Primary Person ListCollector with Variants", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "id": "group", - "title": "Variant Question", - "blocks": [ - { - "type": "Question", - "id": "variant-block", - "question": { - "type": "General", - "id": "variant-question", - "title": "Do you like variants?", - "answers": [ - { - "type": "Radio", - "id": "variant-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "id": "primary-person-list-collector", - "type": "PrimaryPersonListCollector", - "for_list": "people", - "add_or_edit_block": { - "id": "add-or-edit-primary-person", - "type": "PrimaryPersonListAddOrEditQuestion", - "question_variants": [ - { - "question": { - "id": "primary-person-add-or-edit-question", - "type": "General", - "title": "What is your name", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "variant-answer" - }, - "No" - ] - } - }, - { - "question": { - "id": "primary-person-add-or-edit-question", - "type": "General", - "title": "What is your name (variant)", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "variant-answer" - }, - "Yes" - ] - } - } - ] - }, - "question_variants": [ - { - "question": { - "id": "primary-confirmation-question", - "type": "General", - "title": "Do you live here? (variant)", - "answers": [ - { - "id": "you-live-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "variant-answer" - }, - "Yes" - ] - } - }, - { - "question": { - "id": "primary-confirmation-question", - "type": "General", - "title": "Do you live here?", - "answers": [ - { - "id": "you-live-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "variant-answer" - }, - "No" - ] - } - } - ] - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": { - "text": "Change details for {first_name} {last_name}", - "placeholders": [ - { - "placeholder": "first_name", - "value": { - "source": "answers", - "identifier": "first-name" - } - }, - { - "placeholder": "last_name", - "value": { - "source": "answers", - "identifier": "last-name" - } - } - ] - }, - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_list_collector_variants_section_summary.json b/schemas/test/en/test_list_collector_variants_section_summary.json deleted file mode 100644 index 5b8ac29666..0000000000 --- a/schemas/test/en/test_list_collector_variants_section_summary.json +++ /dev/null @@ -1,551 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test List Collector Variants Section Summary Items", - "theme": "default", - "description": "A questionnaire to test list collector section summary items for variants", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section-companies", - "title": "General insurance business", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "companies", - "title": "Companies or UK branches", - "item_anchor_answer_id": "company-or-branch-name", - "item_label": "Name of UK or non-UK company or branch", - "add_link_text": "Add another UK company or branch", - "empty_list_text": "No UK company or branch added", - "related_answers": [ - { - "source": "answers", - "identifier": "registration-number" - }, - { - "source": "answers", - "identifier": "authorised-insurer-radio" - } - ] - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "group-companies", - "blocks": [ - { - "type": "Question", - "id": "uk-based-block", - "question": { - "type": "General", - "id": "uk-based-question", - "title": "Are the companies UK based?", - "answers": [ - { - "type": "Radio", - "id": "uk-based-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "type": "ListCollectorDrivingQuestion", - "id": "any-companies-or-branches", - "for_list": "companies", - "question": { - "type": "General", - "id": "any-companies-or-branches-question", - "title": "Do any companies or branches undertake general insurance business?", - "answers": [ - { - "type": "Radio", - "id": "any-companies-or-branches-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-company", - "list_name": "companies" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "confirmation-checkbox", - "when": { - "==": [ - { - "source": "answers", - "identifier": "any-companies-or-branches-answer" - }, - "No" - ] - } - }, - { - "block": "any-other-companies-or-branches" - } - ] - }, - { - "id": "any-other-companies-or-branches", - "type": "ListCollector", - "for_list": "companies", - "question_variants": [ - { - "question": { - "id": "any-other-companies-or-branches-question", - "type": "General", - "title": "Do you need to add any other UK companies or branches that undertake general insurance business?", - "answers": [ - { - "id": "any-other-companies-or-branches-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "uk-based-answer" - }, - "Yes" - ] - } - }, - { - "question": { - "id": "any-other-companies-or-branches-question", - "type": "General", - "title": "Do you need to add any other non-UK companies or branches that undertake general insurance business?", - "answers": [ - { - "id": "any-other-companies-or-branches-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "uk-based-answer" - }, - "No" - ] - } - } - ], - "add_block": { - "id": "add-company", - "type": "ListAddQuestion", - "question_variants": [ - { - "question": { - "id": "add-question-companies", - "type": "General", - "title": "Give details about the company or branch that undertakes general insurance business", - "answers": [ - { - "id": "company-or-branch-name", - "label": "Name of UK company or branch", - "mandatory": true, - "type": "TextField" - }, - { - "id": "registration-number", - "label": "UK Registration number", - "mandatory": true, - "type": "Number", - "maximum": { - "value": 999, - "exclusive": false - }, - "decimal_places": 0 - }, - { - "type": "Radio", - "label": "Is this UK company or branch an authorised insurer?", - "id": "authorised-insurer-radio", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "uk-based-answer" - }, - "Yes" - ] - } - }, - { - "question": { - "id": "add-question-companies", - "type": "General", - "title": "Give details about the company or branch that undertakes general insurance business", - "answers": [ - { - "id": "company-or-branch-name", - "label": "Name of non-UK company or branch", - "mandatory": true, - "type": "TextField" - }, - { - "id": "registration-number", - "label": "Non-UK Registration number", - "mandatory": true, - "type": "Number", - "maximum": { - "value": 999, - "exclusive": false - }, - "decimal_places": 0 - }, - { - "type": "Radio", - "label": "Is this non-UK company or branch an authorised insurer?", - "id": "authorised-insurer-radio", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "uk-based-answer" - }, - "No" - ] - } - } - ] - }, - "edit_block": { - "id": "edit-company", - "type": "ListEditQuestion", - "question_variants": [ - { - "question": { - "id": "edit-question-companies", - "type": "General", - "title": "What is the name of the company?", - "answers": [ - { - "id": "company-or-branch-name", - "label": "Name of UK company or branch", - "mandatory": true, - "type": "TextField" - }, - { - "id": "registration-number", - "label": "UK Registration number", - "mandatory": true, - "type": "Number" - }, - { - "type": "Radio", - "label": "Is this UK company or branch an authorised insurer?", - "id": "authorised-insurer-radio", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "uk-based-answer" - }, - "Yes" - ] - } - }, - { - "question": { - "id": "edit-question-companies", - "type": "General", - "title": "What is the name of the company?", - "answers": [ - { - "id": "company-or-branch-name", - "label": "Name of non-UK company or branch", - "mandatory": true, - "type": "TextField" - }, - { - "id": "registration-number", - "label": "Non-UK Registration number", - "mandatory": true, - "type": "Number" - }, - { - "type": "Radio", - "label": "Is this non-UK company or branch an authorised insurer?", - "id": "authorised-insurer-radio", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "uk-based-answer" - }, - "No" - ] - } - } - ] - }, - "remove_block": { - "id": "remove-company", - "type": "ListRemoveQuestion", - "question_variants": [ - { - "question": { - "id": "remove-question-companies", - "type": "General", - "title": "Are you sure you want to remove this company or non-UK branch?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "uk-based-answer" - }, - "No" - ] - } - }, - { - "question": { - "id": "remove-question-companies", - "type": "General", - "title": "Are you sure you want to remove this company or non-UK branch?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "uk-based-answer" - }, - "Yes" - ] - } - } - ] - }, - "summary": { - "title": "Companies or UK branches", - "item_title": { - "text": "{company_name}", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "answers", - "identifier": "company-or-branch-name" - } - } - ] - } - } - }, - { - "type": "Question", - "id": "confirmation-checkbox", - "question": { - "answers": [ - { - "id": "confirmation-checkbox-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "confirmation-checkbox-question", - "title": "Are all companies or branches based in UK?", - "type": "General" - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_list_summary_on_question.json b/schemas/test/en/test_list_summary_on_question.json deleted file mode 100644 index 34c881ac18..0000000000 --- a/schemas/test/en/test_list_summary_on_question.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test ListCollector", - "theme": "default", - "description": "A questionnaire to test ListCollector", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "title": "Who Lives Here", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": "Household members", - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - }, - { - "id": "extra-list-group", - "title": "Another List", - "blocks": [ - { - "id": "next-interstitial", - "content": { - "title": "Another list", - "contents": [ - { - "description": "You have added some people to the ‘people’ list. Next we’ll test another list collector adding to the same list. This should still have the same list of people." - } - ] - }, - "type": "Interstitial" - }, - { - "id": "another-list-collector-block", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "another-confirmation-question", - "type": "General", - "title": "This list collector will add to the same ‘people’ list. Add someone else?", - "answers": [ - { - "id": "another-anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "another-add-person", - "type": "ListAddQuestion", - "question": { - "id": "another-add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "another-edit-person", - "type": "ListEditQuestion", - "question": { - "id": "another-edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "another-remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "another-remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "another-remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "type": "Question", - "id": "radio-placeholder", - "question": { - "type": "General", - "id": "radio-placeholder-question", - "title": "Are any of these people related to one another?", - "answers": [ - { - "mandatory": false, - "type": "Radio", - "id": "radio-mandatory-answer", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No, all household members are unrelated", - "value": "No, all household members are unrelated" - } - ] - } - ] - }, - "list_summary": { - "for_list": "people", - "summary": { - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_markup.json b/schemas/test/en/test_markup.json deleted file mode 100644 index 98bf348532..0000000000 --- a/schemas/test/en/test_markup.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Markup test", - "theme": "default", - "description": "A questionnaire to test rendering of markup in questionnaires", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "markup-group", - "title": "Markup", - "blocks": [ - { - "type": "Question", - "id": "emphasis-block", - "question": { - "answers": [ - { - "guidance": { - "show_guidance": "Show lorem ipsum guidance", - "hide_guidance": "hide lorem ipsum guidance", - "contents": [ - { - "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit libero, a pharetra augue. Vestibulum id ligula porta felis euismod semper. Integer posuere erat a ante venenatis dapibus posuere velit aliquet." - } - ] - }, - "id": "answer", - "label": "What is the thing?", - "mandatory": false, - "type": "TextField" - } - ], - "description": [ - "Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur blandit tempus porttitor." - ], - "id": "question", - "title": "This is a title with emphasis", - "type": "General" - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_metadata_routing.json b/schemas/test/en/test_metadata_routing.json deleted file mode 100644 index 1142d57f9e..0000000000 --- a/schemas/test/en/test_metadata_routing.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Household Schema", - "description": "Household Schema", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "boolean_flag", - "type": "boolean" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "group1", - "title": "Group 1", - "blocks": [ - { - "type": "Question", - "id": "block1", - "question": { - "id": "block1-question", - "title": "Question 1", - "type": "General", - "answers": [ - { - "id": "block1-answer", - "mandatory": false, - "type": "TextField", - "label": "Question 1" - } - ] - }, - "routing_rules": [ - { - "block": "block3", - "when": { - "==": [ - { - "identifier": "boolean_flag", - "source": "metadata" - }, - true - ] - } - }, - { - "block": "block2" - } - ] - }, - { - "type": "Question", - "id": "block2", - "question": { - "id": "block2-question", - "title": "Question 2", - "type": "General", - "answers": [ - { - "id": "block2-answer", - "mandatory": false, - "type": "TextField", - "label": "Question 2" - } - ] - } - }, - { - "type": "Question", - "id": "block3", - "question": { - "id": "block3-question", - "title": "Question 3", - "type": "General", - "answers": [ - { - "id": "block3-answer", - "mandatory": false, - "type": "TextField", - "label": "Question 3" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_mobile_number.json b/schemas/test/en/test_mobile_number.json deleted file mode 100644 index 1b02b83758..0000000000 --- a/schemas/test/en/test_mobile_number.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test mobile number", - "theme": "default", - "description": "A questionnaire to test a mobile number", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "mobile-number-block", - "question": { - "answers": [ - { - "id": "mobile-number-answer", - "label": "UK mobile Number", - "mandatory": true, - "type": "MobileNumber" - } - ], - "id": "mobile-number-question", - "title": "What is your mobile number?", - "type": "General" - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_multiple_answers.json b/schemas/test/en/test_multiple_answers.json deleted file mode 100644 index 6f1832cdac..0000000000 --- a/schemas/test/en/test_multiple_answers.json +++ /dev/null @@ -1,217 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "023", - "title": "Multiple answers per question", - "description": "A questionnaire containing questions which have more than one answer", - "theme": "default", - "legal_basis": "Notice is given under section 1 of the Statistics of Trade Act 1947.", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "about-you-block", - "question": { - "id": "about-you-question", - "title": "About You", - "type": "General", - "answers": [ - { - "id": "textfield-answer", - "type": "TextField", - "mandatory": true, - "label": "Your name" - }, - { - "id": "date-answer", - "type": "Date", - "mandatory": true, - "label": "What is your date of birth?" - }, - { - "id": "checkbox-answer", - "type": "Checkbox", - "mandatory": true, - "label": "What are your favourite car brands?", - "instruction": "Select your favourite car brands", - "options": [ - { - "label": "BMW", - "value": "BMW" - }, - { - "label": "Mercedes", - "value": "Mercedes" - }, - { - "label": "Audi", - "value": "Audi" - }, - { - "label": "None of the above", - "value": "None of the above" - } - ] - }, - { - "id": "radio-answer", - "type": "Radio", - "mandatory": true, - "label": "Would you like the sports package?", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - }, - { - "id": "currency-answer", - "type": "Currency", - "currency": "GBP", - "mandatory": true, - "label": "What is your budget?", - "decimal_places": 2 - }, - { - "id": "month-year-date-answer", - "type": "MonthYearDate", - "mandatory": true, - "label": "When would you like the car by?" - }, - { - "id": "dropdown-answer", - "type": "Dropdown", - "mandatory": true, - "label": "Select a colour", - "options": [ - { - "label": "Blue", - "value": "Blue" - }, - { - "label": "Silver", - "value": "Silver" - }, - { - "label": "Black", - "value": "Black" - } - ] - }, - { - "id": "unit-answer", - "type": "Unit", - "unit": "length-mile", - "unit_length": "short", - "mandatory": true, - "label": "Max mileage" - }, - { - "id": "duration-answer", - "type": "Duration", - "units": ["years", "months"], - "mandatory": true, - "label": "How long have you had your licence?" - }, - { - "id": "year-date-answer", - "type": "YearDate", - "mandatory": true, - "label": "Which year did you get your licence?" - }, - { - "id": "number-answer", - "type": "Number", - "mandatory": true, - "label": "How many seats?" - }, - { - "id": "percentage-answer", - "type": "Percentage", - "mandatory": true, - "label": "Max CO2 emissions" - }, - { - "id": "mobile-number-answer", - "type": "MobileNumber", - "mandatory": true, - "label": "What is your mobile number?" - }, - { - "id": "textarea-answer", - "type": "TextArea", - "mandatory": true, - "label": "Other comments" - } - ] - } - }, - { - "type": "Question", - "id": "age-block", - "question": { - "id": "age-question", - "title": "How old are you?", - "type": "General", - "answers": [ - { - "id": "age-answer", - "type": "Number", - "mandatory": true, - "label": "Your age" - }, - { - "id": "age-estimate-answer", - "type": "Checkbox", - "mandatory": true, - "instruction": "Estimate", - "options": [ - { - "label": "This age is an estimate", - "value": "This age is an estimate" - } - ] - } - ] - } - } - ], - "id": "default-group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_multiple_piping.json b/schemas/test/en/test_multiple_piping.json deleted file mode 100644 index a7e56dbb94..0000000000 --- a/schemas/test/en/test_multiple_piping.json +++ /dev/null @@ -1,244 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Multiple piping test survey", - "theme": "default", - "description": "A questionnaire to test multiple piping into a question and answer", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "what-is-your-address-group", - "title": "What is your address?", - "blocks": [ - { - "type": "Question", - "id": "what-is-your-address", - "question": { - "id": "what-is-your-address-question", - "title": "What is your address?", - "type": "General", - "answers": [ - { - "id": "building", - "label": "Building", - "mandatory": false, - "type": "TextField" - }, - { - "id": "address-line-1", - "label": "Address Line 1", - "mandatory": true, - "type": "TextField", - "validation": { - "messages": { - "MANDATORY_TEXTFIELD": "Enter an address to continue" - } - } - }, - { - "id": "address-line-2", - "label": "Address Line 2", - "mandatory": false, - "type": "TextField" - }, - { - "id": "address-line-3", - "label": "Address Line 3", - "mandatory": false, - "type": "TextField" - }, - { - "id": "town-city", - "label": "Town/City", - "mandatory": false, - "type": "TextField" - }, - { - "id": "county", - "label": "County", - "mandatory": false, - "type": "TextField" - }, - { - "id": "postcode", - "label": "Postcode", - "mandatory": false, - "type": "TextField" - }, - { - "id": "country", - "label": "Country", - "mandatory": false, - "type": "TextField" - } - ] - } - }, - { - "type": "Question", - "id": "textfield", - "question": { - "id": "textfield-question", - "title": "Enter text below", - "type": "General", - "answers": [ - { - "id": "first-text", - "label": "Enter Name 1", - "mandatory": true, - "type": "TextField", - "validation": { - "messages": { - "MANDATORY_TEXTFIELD": "Please enter text?" - } - } - }, - { - "id": "second-text", - "label": "Enter Name 2", - "mandatory": false, - "type": "TextField" - } - ] - } - }, - { - "type": "Question", - "id": "piping-question", - "question": { - "id": "multiple-piping-question", - "title": { - "text": "Does {person} live at {address}", - "placeholders": [ - { - "placeholder": "person", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-text" - }, - { - "source": "answers", - "identifier": "second-text" - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "address", - "value": { - "source": "answers", - "identifier": "address-line-1" - } - } - ] - }, - "type": "General", - "answers": [ - { - "id": "multiple-piping-answer", - "type": "Radio", - "mandatory": true, - "options": [ - { - "label": { - "text": "{address}", - "placeholders": [ - { - "placeholder": "address", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "building" - }, - { - "source": "answers", - "identifier": "address-line-1" - }, - { - "source": "answers", - "identifier": "address-line-2" - }, - { - "source": "answers", - "identifier": "address-line-3" - }, - { - "source": "answers", - "identifier": "town-city" - }, - { - "source": "answers", - "identifier": "county" - }, - { - "source": "answers", - "identifier": "postcode" - }, - { - "source": "answers", - "identifier": "country" - } - ], - "delimiter": ", " - } - } - ] - } - ] - }, - "value": "{address}" - }, - { - "label": "at another address", - "value": "at another address" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_mutually_exclusive.json b/schemas/test/en/test_mutually_exclusive.json deleted file mode 100644 index e691163842..0000000000 --- a/schemas/test/en/test_mutually_exclusive.json +++ /dev/null @@ -1,573 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Mutually Exclusive", - "theme": "default", - "description": "A questionnaire to demo mutually exclusive answers with single checkbox override", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": true - } - } - }, - "sections": [ - { - "id": "mutually-exclusive-checkbox-section", - "title": "Checkbox", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-mandatory-group", - "title": "Mutually Exclusive With Single Checkbox Override - Mandatory", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-checkbox", - "question": { - "id": "mutually-exclusive-checkbox-question", - "type": "MutuallyExclusive", - "title": "What is your nationality?", - "warning": "This is important", - "mandatory": true, - "answers": [ - { - "id": "checkbox-answer", - "instruction": "Select an answer", - "type": "Checkbox", - "mandatory": false, - "options": [ - { - "label": "British", - "value": "British" - }, - { - "label": "Irish", - "value": "Irish" - }, - { - "label": "Other", - "description": "Enter another Nationality", - "value": "Other", - "detail_answer": { - "mandatory": false, - "id": "checkbox-child-other-answer", - "label": "Please specify other", - "type": "TextField" - } - } - ] - }, - { - "id": "checkbox-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "description": "Some description", - "value": "I prefer not to say" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-mandatory-date-section", - "title": "Date", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-mandatory-date-group", - "title": "Mutually Exclusive With Single Checkbox Override - Mandatory", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-mandatory-date", - "question": { - "id": "mutually-exclusive-mandatory-date-question", - "type": "MutuallyExclusive", - "title": "When did you leave your last paid job?", - "mandatory": true, - "answers": [ - { - "id": "mandatory-date-answer", - "label": "Enter a date", - "mandatory": false, - "type": "Date" - }, - { - "id": "mandatory-date-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-date-section", - "title": "Date", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-date-group", - "title": "Mutually Exclusive With Single Checkbox Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-date", - "question": { - "id": "mutually-exclusive-date-question", - "type": "MutuallyExclusive", - "title": "When did you leave your last paid job?", - "mandatory": false, - "answers": [ - { - "id": "date-answer", - "label": "Enter a date", - "mandatory": false, - "type": "Date" - }, - { - "id": "date-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-currency-section", - "title": "Currency", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-currency-group", - "title": "Mutually Exclusive With Single Checkbox Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-currency", - "question": { - "id": "mutually-exclusive-currency-question", - "type": "MutuallyExclusive", - "title": "What is your annual income before tax?", - "mandatory": false, - "answers": [ - { - "id": "currency-answer", - "label": "Enter your income", - "mandatory": false, - "type": "Currency", - "currency": "GBP" - }, - { - "id": "currency-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-number-section", - "title": "Number", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-number-group", - "title": "Mutually Exclusive With Single Checkbox Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-number", - "question": { - "id": "mutually-exclusive-number-question", - "type": "MutuallyExclusive", - "title": "What is your favourite number?", - "mandatory": false, - "answers": [ - { - "id": "number-answer", - "label": "Enter your favourite number", - "mandatory": false, - "type": "Number", - "decimal_places": 2 - }, - { - "id": "number-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-percentage-section", - "title": "Percentage", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-percentage-group", - "title": "Mutually Exclusive With Single Checkbox Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-percentage", - "question": { - "id": "mutually-exclusive-percentage-question", - "type": "MutuallyExclusive", - "title": "What was the percentage increase in your annual income this tax year?", - "mandatory": false, - "answers": [ - { - "id": "percentage-answer", - "label": "Enter the percentage increase of your income", - "mandatory": false, - "type": "Percentage", - "maximum": { - "value": 100 - } - }, - { - "id": "percentage-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-textfield-section", - "title": "Textfield", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-textfield-group", - "title": "Mutually Exclusive With Single Checkbox Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-textfield", - "question": { - "id": "mutually-exclusive-textfield-question", - "type": "MutuallyExclusive", - "title": "What is your favourite colour?", - "mandatory": false, - "answers": [ - { - "id": "textfield-answer", - "label": "Enter your favourite colour", - "mandatory": false, - "type": "TextField" - }, - { - "id": "textfield-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-month-year-date-section", - "title": "Month Year Date", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-month-year-date-group", - "title": "Mutually Exclusive With Single Checkbox Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-month-year-date", - "question": { - "id": "mutually-exclusive-month-year-date-question", - "type": "MutuallyExclusive", - "title": "When did you leave your last paid job?", - "mandatory": false, - "answers": [ - { - "id": "month-year-date-answer", - "label": "Enter a date", - "mandatory": false, - "type": "MonthYearDate", - "maximum": { - "value": "now" - } - }, - { - "id": "month-year-date-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-year-date-section", - "title": "Year Date", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-year-date-group", - "title": "Mutually Exclusive With Single Checkbox Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-year-date", - "question": { - "id": "mutually-exclusive-year-date-question", - "type": "MutuallyExclusive", - "title": "When did you leave your last paid job?", - "mandatory": false, - "answers": [ - { - "id": "year-date-answer", - "label": "Enter a date", - "mandatory": false, - "type": "YearDate", - "maximum": { - "value": "now" - } - }, - { - "id": "year-date-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-unit-section", - "title": "Unit", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-unit-group", - "title": "Mutually Exclusive With Single Checkbox Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-unit", - "question": { - "id": "mutually-exclusive-unit-question", - "type": "MutuallyExclusive", - "title": "How many years have you been in the UK?", - "mandatory": false, - "answers": [ - { - "id": "unit-answer", - "label": "Enter the number of years you have lived in the UK", - "unit": "duration-year", - "type": "Unit", - "unit_length": "long", - "mandatory": false - }, - { - "id": "unit-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-duration-section", - "title": "Duration", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-duration-group", - "title": "Mutually Exclusive With Single Checkbox Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-duration", - "question": { - "id": "mutually-exclusive-duration-question", - "type": "MutuallyExclusive", - "title": "How long have you been employed for?", - "mandatory": false, - "answers": [ - { - "id": "duration-answer", - "mandatory": false, - "units": ["years", "months"], - "type": "Duration" - }, - { - "id": "duration-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-textarea-section", - "title": "TextArea", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-textarea-group", - "title": "Mutually Exclusive With Single Checkbox Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-textarea", - "question": { - "id": "mutually-exclusive-textarea-question", - "type": "MutuallyExclusive", - "title": "Why did you leave your last job?", - "mandatory": false, - "answers": [ - { - "id": "textarea-answer", - "mandatory": false, - "type": "TextArea" - }, - { - "id": "textarea-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_mutually_exclusive_multiple.json b/schemas/test/en/test_mutually_exclusive_multiple.json deleted file mode 100644 index a4603cc5a2..0000000000 --- a/schemas/test/en/test_mutually_exclusive_multiple.json +++ /dev/null @@ -1,622 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Mutually Exclusive Multiple", - "theme": "default", - "description": "A questionnaire to demo mutually exclusive answers with multiple radio override", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": true - } - } - }, - "sections": [ - { - "id": "mutually-exclusive-checkbox-section", - "title": "Checkbox", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-checkbox-mandatory-group", - "title": "Mutually Exclusive With Multiple Radio Override - Mandatory", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-checkbox", - "question": { - "id": "mutually-exclusive-checkbox-question", - "type": "MutuallyExclusive", - "title": "What is your nationality?", - "warning": "This is important", - "mandatory": true, - "answers": [ - { - "id": "checkbox-answer", - "instruction": "Select an answer", - "type": "Checkbox", - "mandatory": false, - "options": [ - { - "label": "British", - "value": "British" - }, - { - "label": "Irish", - "value": "Irish" - }, - { - "label": "Other", - "description": "Enter another Nationality", - "value": "Other", - "detail_answer": { - "mandatory": false, - "id": "checkbox-child-other-answer", - "label": "Please specify other", - "type": "TextField" - } - } - ] - }, - { - "id": "checkbox-exclusive-answer", - "mandatory": false, - "type": "Radio", - "options": [ - { - "label": "I prefer not to say", - "description": "Some description", - "value": "I prefer not to say" - }, - { - "label": "I am an alien", - "description": "Some description", - "value": "I am an alien" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-mandatory-date-section", - "title": "Date", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-mandatory-date-group", - "title": "Mutually Exclusive With Multiple Radio Override - Mandatory", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-mandatory-date", - "question": { - "id": "mutually-exclusive-mandatory-date-question", - "type": "MutuallyExclusive", - "title": "When did you leave your last paid job?", - "mandatory": true, - "answers": [ - { - "id": "mandatory-date-answer", - "label": "Enter a date", - "mandatory": false, - "type": "Date" - }, - { - "id": "mandatory-date-exclusive-answer", - "mandatory": false, - "type": "Radio", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - }, - { - "label": "I have never worked", - "value": "I have never worked" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-date-section", - "title": "Date", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-date-group", - "title": "Mutually Exclusive With Multiple Radio Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-date", - "question": { - "id": "mutually-exclusive-date-question", - "type": "MutuallyExclusive", - "title": "When did you leave your last paid job?", - "mandatory": false, - "answers": [ - { - "id": "date-answer", - "label": "Enter a date", - "mandatory": false, - "type": "Date" - }, - { - "id": "date-exclusive-answer", - "mandatory": false, - "type": "Radio", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - }, - { - "label": "I have never worked", - "value": "I have never worked" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-currency-section", - "title": "Currency", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-currency-group", - "title": "Mutually Exclusive With Multiple Radio Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-currency", - "question": { - "id": "mutually-exclusive-currency-question", - "type": "MutuallyExclusive", - "title": "What is your annual income before tax?", - "mandatory": false, - "answers": [ - { - "id": "currency-answer", - "label": "Enter your income", - "mandatory": false, - "type": "Currency", - "currency": "GBP" - }, - { - "id": "currency-exclusive-answer", - "mandatory": false, - "type": "Radio", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - }, - { - "label": "I have no income", - "value": "I have no income" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-number-section", - "title": "Number", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-number-group", - "title": "Mutually Exclusive With Multiple Radio Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-number", - "question": { - "id": "mutually-exclusive-number-question", - "type": "MutuallyExclusive", - "title": "What is your favourite number?", - "mandatory": false, - "answers": [ - { - "id": "number-answer", - "label": "Enter your favourite number", - "mandatory": false, - "type": "Number", - "decimal_places": 2 - }, - { - "id": "number-exclusive-answer", - "mandatory": false, - "type": "Radio", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - }, - { - "label": "I dont have a favourite number", - "value": "I dont have a favourite number" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-percentage-section", - "title": "Percentage", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-percentage-group", - "title": "Mutually Exclusive With Multiple Radio Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-percentage", - "question": { - "id": "mutually-exclusive-percentage-question", - "type": "MutuallyExclusive", - "title": "What was the percentage increase in your annual income this tax year?", - "mandatory": false, - "answers": [ - { - "id": "percentage-answer", - "label": "Enter the percentage increase of your income", - "mandatory": false, - "type": "Percentage", - "maximum": { - "value": 100 - } - }, - { - "id": "percentage-exclusive-answer", - "mandatory": false, - "type": "Radio", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - }, - { - "label": "No income change", - "value": "No income change" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-textfield-section", - "title": "Textfield", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-textfield-group", - "title": "Mutually Exclusive With Multiple Radio Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-textfield", - "question": { - "id": "mutually-exclusive-textfield-question", - "type": "MutuallyExclusive", - "title": "What is your favourite colour?", - "mandatory": false, - "answers": [ - { - "id": "textfield-answer", - "label": "Enter your favourite colour", - "mandatory": false, - "type": "TextField" - }, - { - "id": "textfield-exclusive-answer", - "mandatory": false, - "type": "Radio", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - }, - { - "label": "I dont have a favorite colour", - "value": "I dont have a favorite colour" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-month-year-date-section", - "title": "Month Year Date", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-month-year-date-group", - "title": "Mutually Exclusive With Multiple Radio Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-month-year-date", - "question": { - "id": "mutually-exclusive-month-year-date-question", - "type": "MutuallyExclusive", - "title": "When did you leave your last paid job?", - "mandatory": false, - "answers": [ - { - "id": "month-year-date-answer", - "label": "Enter a date", - "mandatory": false, - "type": "MonthYearDate", - "maximum": { - "value": "now" - } - }, - { - "id": "month-year-date-exclusive-answer", - "mandatory": false, - "type": "Radio", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - }, - { - "label": "I have never worked", - "value": "I have never worked" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-year-date-section", - "title": "Year Date", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-year-date-group", - "title": "Mutually Exclusive With Multiple Radio Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-year-date", - "question": { - "id": "mutually-exclusive-year-date-question", - "type": "MutuallyExclusive", - "title": "When did you leave your last paid job?", - "mandatory": false, - "answers": [ - { - "id": "year-date-answer", - "label": "Enter a date", - "mandatory": false, - "type": "YearDate", - "maximum": { - "value": "now" - } - }, - { - "id": "year-date-exclusive-answer", - "mandatory": false, - "type": "Radio", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - }, - { - "label": "I have never worked", - "value": "I have never worked" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-unit-section", - "title": "Unit", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-unit-group", - "title": "Mutually Exclusive With Multiple Radio Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-unit", - "question": { - "id": "mutually-exclusive-unit-question", - "type": "MutuallyExclusive", - "title": "How many years have you been in the UK?", - "mandatory": false, - "answers": [ - { - "id": "unit-answer", - "label": "Enter the number of years you have lived in the UK", - "unit": "duration-year", - "type": "Unit", - "unit_length": "long", - "mandatory": false - }, - { - "id": "unit-exclusive-answer", - "mandatory": false, - "type": "Radio", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - }, - { - "label": "I have never lived in the UK", - "value": "I have never lived in the UK" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-duration-section", - "title": "Duration", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-duration-group", - "title": "Mutually Exclusive With Multiple Radio Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-duration", - "question": { - "id": "mutually-exclusive-duration-question", - "type": "MutuallyExclusive", - "title": "How long have you been employed for?", - "mandatory": false, - "answers": [ - { - "id": "duration-answer", - "mandatory": false, - "units": ["years", "months"], - "type": "Duration" - }, - { - "id": "duration-exclusive-answer", - "mandatory": false, - "type": "Radio", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - }, - { - "label": "I have never worked", - "value": "I have never worked" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "mutually-exclusive-textarea-section", - "title": "TextArea", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "mutually-exclusive-textarea-group", - "title": "Mutually Exclusive With Multiple Radio Override - Optional", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-textarea", - "question": { - "id": "mutually-exclusive-textarea-question", - "type": "MutuallyExclusive", - "title": "Why did you leave your last job?", - "mandatory": false, - "answers": [ - { - "id": "textarea-answer", - "mandatory": false, - "type": "TextArea" - }, - { - "id": "textarea-exclusive-answer", - "mandatory": false, - "type": "Radio", - "options": [ - { - "label": "I prefer not to say", - "value": "I prefer not to say" - }, - { - "label": "I have never worked", - "value": "I have never worked" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_new_calculated_summary.json b/schemas/test/en/test_new_calculated_summary.json deleted file mode 100644 index 9e10f5cd04..0000000000 --- a/schemas/test/en/test_new_calculated_summary.json +++ /dev/null @@ -1,571 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "A test schema to demo Calculated Summary", - "theme": "default", - "description": "A schema to showcase Calculated Summary pages and usage in value source.", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "group", - "title": "Total a range of values", - "blocks": [ - { - "type": "Question", - "id": "first-number-block", - "question": { - "id": "first-number-question", - "title": "First Number Question Title", - "type": "General", - "answers": [ - { - "id": "first-number-answer", - "label": "First answer label", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "minimum": { - "value": -1000, - "exclusive": false - } - } - ] - } - }, - { - "type": "Question", - "id": "second-number-block", - "question": { - "id": "second-number-question", - "title": "Second Number Question Title", - "type": "General", - "answers": [ - { - "id": "second-number-answer", - "label": "Second answer in currency label", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "minimum": { - "value": -1000, - "exclusive": false - } - }, - { - "id": "second-number-answer-unit-total", - "label": "Second answer label in unit total", - "mandatory": true, - "type": "Unit", - "unit_length": "short", - "unit": "length-centimeter" - }, - { - "id": "second-number-answer-also-in-total", - "label": "Second answer label also in currency total (optional)", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "minimum": { - "value": -1000, - "exclusive": false - } - } - ] - } - }, - { - "type": "Question", - "id": "third-number-block", - "question": { - "id": "third-number-question", - "title": "Third Number Question Title", - "type": "General", - "answers": [ - { - "id": "third-number-answer", - "label": "Third answer label", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "minimum": { - "value": -1000, - "exclusive": false - } - } - ] - } - }, - { - "type": "Question", - "id": "third-and-a-half-number-block", - "question": { - "id": "third-and-a-half-number-question-unit-total", - "title": "Third Number Question Title Unit Total", - "type": "General", - "answers": [ - { - "id": "third-and-a-half-number-answer-unit-total", - "label": "Third answer label in unit total", - "mandatory": true, - "type": "Unit", - "unit_length": "short", - "unit": "length-centimeter" - } - ] - } - }, - { - "type": "Question", - "id": "skip-fourth-block", - "question": { - "type": "General", - "id": "skip-fourth-block-question", - "title": "Skip Fourth Block so it doesn’t appear in Total?", - "answers": [ - { - "type": "Radio", - "id": "skip-fourth-block-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "skip-fourth-block-answer", - "source": "answers" - }, - "Yes" - ] - } - }, - "type": "Question", - "id": "fourth-number-block", - "question": { - "id": "fourth-number-question", - "title": "Fourth Number Question Title", - "type": "General", - "answers": [ - { - "id": "fourth-number-answer", - "label": "Fourth answer label (optional)", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "skip-fourth-block-answer", - "source": "answers" - }, - "Yes" - ] - } - }, - "type": "Question", - "id": "fourth-and-a-half-number-block", - "question": { - "id": "fourth-and-a-half-number-question-also-in-total", - "title": "Fourth Number Additional Question Title", - "type": "General", - "answers": [ - { - "id": "fourth-and-a-half-number-answer-also-in-total", - "label": "Fourth answer label also in total (optional)", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "fifth-number-block", - "question": { - "id": "fifth-number-question", - "title": "Fifth Number Question Title Percentage", - "type": "General", - "answers": [ - { - "id": "fifth-percent-answer", - "label": "Fifth answer label percentage total", - "mandatory": true, - "type": "Percentage", - "maximum": { - "value": 100 - } - }, - { - "id": "fifth-number-answer", - "label": "Fifth answer label number total", - "mandatory": false, - "type": "Number", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "sixth-number-block", - "question": { - "id": "sixth-number-question", - "title": "Sixth Number Question Title Percentage", - "type": "General", - "answers": [ - { - "id": "sixth-percent-answer", - "label": "Sixth answer label percentage total", - "mandatory": true, - "type": "Percentage", - "maximum": { - "value": 100 - } - }, - { - "id": "sixth-number-answer", - "label": "Sixth answer label number total", - "mandatory": false, - "type": "Number", - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "currency-total-playback", - "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "first-number-answer" - }, - { - "source": "answers", - "identifier": "second-number-answer" - }, - { - "source": "answers", - "identifier": "second-number-answer-also-in-total" - }, - { - "source": "answers", - "identifier": "third-number-answer" - }, - { - "source": "answers", - "identifier": "fourth-number-answer" - }, - { - "source": "answers", - "identifier": "fourth-and-a-half-number-answer-also-in-total" - } - ] - }, - "title": "Grand total of previous values" - } - }, - { - "type": "CalculatedSummary", - "id": "unit-total-playback", - "title": "We calculate the total of unit values entered to be %(total)s. Is this correct?", - "page_title": "Total Unit Values", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "second-number-answer-unit-total" - }, - { - "source": "answers", - "identifier": "third-and-a-half-number-answer-unit-total" - } - ] - }, - "title": "Grand total of previous values" - } - }, - { - "type": "CalculatedSummary", - "id": "percentage-total-playback", - "title": "We calculate the total of percentage values entered to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "fifth-percent-answer" - }, - { - "source": "answers", - "identifier": "sixth-percent-answer" - } - ] - }, - "title": "Grand total of previous values" - } - }, - { - "type": "CalculatedSummary", - "id": "number-total-playback", - "title": "We calculate the total of number values entered to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "fifth-number-answer" - }, - { - "source": "answers", - "identifier": "sixth-number-answer" - } - ] - }, - "title": "Grand total of previous values" - } - }, - { - "type": "Interstitial", - "id": "calculated-summary-total-confirmation", - "content": { - "title": "You have provided the following grand totals.", - "contents": [ - { - "list": [ - { - "text": "Total currency values: {currency_total}", - "placeholders": [ - { - "placeholder": "currency_total", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "source": "calculated_summary", - "identifier": "currency-total-playback" - } - } - } - ] - } - ] - }, - { - "text": "Total unformatted unit values: {unit_total}", - "placeholders": [ - { - "placeholder": "unit_total", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "calculated_summary", - "identifier": "unit-total-playback" - } - } - } - ] - } - ] - }, - { - "text": "Total formatted unit values: {unit_total}", - "placeholders": [ - { - "placeholder": "unit_total", - "transforms": [ - { - "transform": "format_unit", - "arguments": { - "value": { - "source": "calculated_summary", - "identifier": "unit-total-playback" - }, - "unit": "length-centimeter", - "unit_length": "short" - } - } - ] - } - ] - }, - { - "text": "Total unformatted percentage values: {percentage_total}", - "placeholders": [ - { - "placeholder": "percentage_total", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "calculated_summary", - "identifier": "percentage-total-playback" - } - } - } - ] - } - ] - }, - { - "text": "Total formatted percentage values: {percentage_total}", - "placeholders": [ - { - "placeholder": "percentage_total", - "transforms": [ - { - "transform": "format_percentage", - "arguments": { - "value": { - "source": "calculated_summary", - "identifier": "percentage-total-playback" - } - } - } - ] - } - ] - }, - { - "text": "Total number values: {number_total}", - "placeholders": [ - { - "placeholder": "number_total", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "calculated_summary", - "identifier": "number-total-playback" - } - } - } - ] - } - ] - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "set-min-max-block", - "question": { - "answers": [ - { - "id": "set-minimum-answer", - "label": "Set a value greater than the total above", - "mandatory": true, - "description": "This is a description of the minimum value", - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "minimum": { - "value": { - "source": "calculated_summary", - "identifier": "currency-total-playback" - } - } - }, - { - "id": "set-maximum-answer", - "description": "This is a description of the maximum value", - "label": "Set a value less than the total above", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "maximum": { - "value": { - "source": "calculated_summary", - "identifier": "currency-total-playback" - } - } - } - ], - "id": "set-min-question", - "title": { - "placeholders": [ - { - "placeholder": "calculated_summary_answer", - "value": { - "identifier": "currency-total-playback", - "source": "calculated_summary" - } - } - ], - "text": "Set minimum and maximum values based on your calculated summary total of £{calculated_summary_answer}" - }, - "type": "General" - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_new_calculated_summary_cross_section_dependencies.json b/schemas/test/en/test_new_calculated_summary_cross_section_dependencies.json deleted file mode 100644 index d79882b3d1..0000000000 --- a/schemas/test/en/test_new_calculated_summary_cross_section_dependencies.json +++ /dev/null @@ -1,375 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Calculated Summary Cross Section Dependencies", - "theme": "default", - "description": "A questionnaire to demo resolution of calculated summary values across sections", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "questions-section", - "title": "Questions", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "radio", - "title": "Questions", - "blocks": [ - { - "type": "Question", - "id": "skip-first-block", - "question": { - "type": "General", - "id": "skip-first-block-question", - "title": "Skip First Block so it doesn’t appear in Total?", - "answers": [ - { - "type": "Radio", - "id": "skip-first-block-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "skip-first-block-answer", - "source": "answers" - }, - "Yes" - ] - } - }, - "type": "Question", - "id": "first-number-block", - "question": { - "id": "first-number-question", - "title": "First Number Question Title", - "type": "General", - "answers": [ - { - "id": "first-number-answer", - "label": "First answer label (optional)", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "skip-first-block-answer", - "source": "answers" - }, - "Yes" - ] - } - }, - "type": "Question", - "id": "first-and-a-half-number-block", - "question": { - "id": "first-and-a-half-number-question-also-in-total", - "title": "First Number Additional Question Title", - "type": "General", - "answers": [ - { - "id": "first-and-a-half-number-answer-also-in-total", - "label": "First answer label also in total (optional)", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "second-number-block", - "question": { - "id": "second-number-question-also-in-total", - "title": "Second Number Additional Question Title", - "type": "General", - "answers": [ - { - "id": "second-number-answer-also-in-total", - "label": "Second answer label also in total (optional)", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "currency-total-playback-1", - "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "first-number-answer" - }, - { - "source": "answers", - "identifier": "first-and-a-half-number-answer-also-in-total" - }, - { - "source": "answers", - "identifier": "second-number-answer-also-in-total" - } - ] - }, - "title": "Grand total of previous values" - } - } - ] - } - ] - }, - { - "id": "calculated-summary-section", - "title": "Calculated Summary", - "summary": { "show_on_completion": true }, - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "third-number-block", - "question": { - "id": "third-number-question", - "title": "Third Number Question Title", - "type": "General", - "answers": [ - { - "id": "third-number-answer", - "label": "Third answer in currency label", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "third-number-answer-also-in-total", - "label": "Third answer label also in currency total (optional)", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "currency-total-playback-2", - "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "third-number-answer" - }, - { - "source": "answers", - "identifier": "third-number-answer-also-in-total" - } - ] - }, - "title": "Grand total of previous values" - } - }, - { - "type": "Question", - "id": "mutually-exclusive-checkbox", - "question": { - "id": "mutually-exclusive-checkbox-question", - "type": "MutuallyExclusive", - "title": "Which answer did you give to question 4 and a half?", - "mandatory": true, - "answers": [ - { - "id": "checkbox-answer", - "instruction": "Select an answer", - "type": "Checkbox", - "mandatory": false, - "options": [ - { - "label": { - "placeholders": [ - { - "placeholder": "answer_value_1", - "value": { - "identifier": "first-and-a-half-number-answer-also-in-total", - "source": "answers" - } - } - ], - "text": "{answer_value_1} - first and a half answer" - }, - "value": "{answer_value_1}" - }, - { - "label": { - "placeholders": [ - { - "placeholder": "calc_value_1", - "value": { - "identifier": "currency-total-playback-1", - "source": "calculated_summary" - } - } - ], - "text": "{calc_value_1} - calculated summary answer (previous section)" - }, - "value": "{calc_value_1}" - }, - { - "label": { - "placeholders": [ - { - "placeholder": "calc_value_2", - "value": { - "identifier": "currency-total-playback-2", - "source": "calculated_summary" - } - } - ], - "text": "{calc_value_2} - calculated summary answer (current section)" - }, - "value": "{calc_value_2}" - }, - { - "label": { - "placeholders": [ - { - "placeholder": "third_answer_value", - "value": { - "identifier": "third-number-answer", - "source": "answers" - } - } - ], - "text": "{third_answer_value} - third answer" - }, - "value": "{third_answer_value}" - } - ] - }, - { - "id": "checkbox-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "description": "Some description", - "value": "I prefer not to say" - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "set-min-max-block", - "question": { - "answers": [ - { - "id": "set-minimum-answer", - "label": "Set a value greater than the total above", - "mandatory": true, - "description": "This is a description of the minimum value", - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "minimum": { - "value": { - "source": "calculated_summary", - "identifier": "currency-total-playback-1" - } - } - }, - { - "id": "set-maximum-answer", - "description": "This is a description of the maximum value", - "label": "Set a value less than the total above", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "maximum": { - "value": { - "source": "calculated_summary", - "identifier": "currency-total-playback-1" - } - } - } - ], - "id": "set-min-question", - "title": { - "placeholders": [ - { - "placeholder": "calculated_summary_answer", - "value": { - "identifier": "currency-total-playback-1", - "source": "calculated_summary" - } - } - ], - "text": "Set minimum and maximum values based on your calculated summary total of £{calculated_summary_answer}" - }, - "type": "General" - } - } - ], - "id": "calculated-summary" - } - ] - } - ] -} diff --git a/schemas/test/en/test_new_calculated_summary_cross_section_dependencies_repeating.json b/schemas/test/en/test_new_calculated_summary_cross_section_dependencies_repeating.json deleted file mode 100644 index 5bfb54b9a2..0000000000 --- a/schemas/test/en/test_new_calculated_summary_cross_section_dependencies_repeating.json +++ /dev/null @@ -1,603 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Calculated Summary Cross Section Dependencies", - "theme": "default", - "description": "A questionnaire to demo resolution of calculated summary values across sections", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section", - "title": "Household", - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "primary-person-list-collector", - "type": "PrimaryPersonListCollector", - "for_list": "people", - "add_or_edit_block": { - "id": "add-or-edit-primary-person", - "type": "PrimaryPersonListAddOrEditQuestion", - "question": { - "id": "primary-person-add-or-edit-question", - "type": "General", - "title": "What is your name?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "question": { - "id": "primary-confirmation-question", - "type": "General", - "title": "Do you live here?", - "answers": [ - { - "id": "you-live-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "questions-section", - "title": "Questions", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "radio", - "title": "Questions", - "blocks": [ - { - "type": "Question", - "id": "skip-first-block", - "question": { - "type": "General", - "id": "skip-first-block-question", - "title": "Skip First Block so it doesn’t appear in Total?", - "answers": [ - { - "type": "Radio", - "id": "skip-first-block-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "skip-first-block-answer", - "source": "answers" - }, - "Yes" - ] - } - }, - "type": "Question", - "id": "first-number-block", - "question": { - "id": "first-number-question", - "title": "First Number Question Title", - "type": "General", - "answers": [ - { - "id": "first-number-answer", - "label": "First answer label (optional)", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "skip-first-block-answer", - "source": "answers" - }, - "Yes" - ] - } - }, - "type": "Question", - "id": "first-and-a-half-number-block", - "question": { - "id": "first-and-a-half-number-question-also-in-total", - "title": "First Number Additional Question Title", - "type": "General", - "answers": [ - { - "id": "first-and-a-half-number-answer-also-in-total", - "label": "First answer label also in total (optional)", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "second-number-block", - "question": { - "id": "second-number-question-also-in-total", - "title": "Second Number Additional Question Title", - "type": "General", - "answers": [ - { - "id": "second-number-answer-also-in-total", - "label": "Second answer label also in total (optional)", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "currency-total-playback-1", - "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "first-number-answer" - }, - { - "source": "answers", - "identifier": "first-and-a-half-number-answer-also-in-total" - }, - { - "source": "answers", - "identifier": "second-number-answer-also-in-total" - } - ] - }, - "title": "Grand total of previous values" - } - } - ] - } - ] - }, - { - "id": "calculated-summary-section", - "title": "Calculated Summary", - "summary": { "show_on_completion": true }, - "repeat": { - "for_list": "people", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "third-number-block", - "question": { - "id": "third-number-question", - "title": "Third Number Question Title", - "type": "General", - "answers": [ - { - "id": "third-number-answer", - "label": "Third answer in currency label", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "third-number-answer-also-in-total", - "label": "Third answer label also in currency total (optional)", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "currency-total-playback-2", - "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "third-number-answer" - }, - { - "source": "answers", - "identifier": "third-number-answer-also-in-total" - } - ] - }, - "title": "Grand total of previous values" - } - }, - { - "type": "Question", - "id": "mutually-exclusive-checkbox", - "question": { - "id": "mutually-exclusive-checkbox-question", - "type": "MutuallyExclusive", - "title": "Which answer did you give to question 4 and a half?", - "mandatory": false, - "answers": [ - { - "id": "checkbox-answer", - "instruction": "Select an answer", - "type": "Checkbox", - "mandatory": false, - "options": [ - { - "label": { - "placeholders": [ - { - "placeholder": "answer_value_1", - "value": { - "identifier": "first-and-a-half-number-answer-also-in-total", - "source": "answers" - } - } - ], - "text": "{answer_value_1} - first and a half answer" - }, - "value": "{answer_value_1}" - }, - { - "label": { - "placeholders": [ - { - "placeholder": "calc_value_1", - "value": { - "identifier": "currency-total-playback-1", - "source": "calculated_summary" - } - } - ], - "text": "{calc_value_1} - calculated summary answer (previous section)" - }, - "value": "{calc_value_1}" - }, - { - "label": { - "placeholders": [ - { - "placeholder": "calc_value_2", - "value": { - "identifier": "currency-total-playback-2", - "source": "calculated_summary" - } - } - ], - "text": "{calc_value_2} - calculated summary answer (current section)" - }, - "value": "{calc_value_2}" - }, - { - "label": { - "placeholders": [ - { - "placeholder": "third_answer_value", - "value": { - "identifier": "third-number-answer", - "source": "answers" - } - } - ], - "text": "{third_answer_value} - third answer" - }, - "value": "{third_answer_value}" - } - ] - }, - { - "id": "checkbox-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "description": "Some description", - "value": "I prefer not to say" - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "set-min-max-block", - "question": { - "answers": [ - { - "id": "set-minimum-answer", - "label": "Set a value greater than the total above", - "mandatory": true, - "description": "This is a description of the minimum value", - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "minimum": { - "value": { - "source": "calculated_summary", - "identifier": "currency-total-playback-1" - } - } - }, - { - "id": "set-maximum-answer", - "description": "This is a description of the maximum value", - "label": "Set a value less than the total above", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "maximum": { - "value": { - "source": "calculated_summary", - "identifier": "currency-total-playback-1" - } - } - } - ], - "id": "set-min-question", - "title": { - "placeholders": [ - { - "placeholder": "calculated_summary_answer", - "value": { - "identifier": "currency-total-playback-1", - "source": "calculated_summary" - } - } - ], - "text": "Set minimum and maximum values based on your calculated summary total of £{calculated_summary_answer}" - }, - "type": "General" - } - } - ], - "id": "calculated-summary" - } - ] - } - ] -} diff --git a/schemas/test/en/test_new_calculated_summary_dependent_questions.json b/schemas/test/en/test_new_calculated_summary_dependent_questions.json deleted file mode 100644 index ada5453af6..0000000000 --- a/schemas/test/en/test_new_calculated_summary_dependent_questions.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "A test schema to demo Calculated Summary", - "description": "A schema to showcase Calculated Summary with dependent questions.", - "questionnaire_flow": { - "type": "Linear", - "options": {} - }, - "sections": [ - { - "id": "default-section", - "title": "Section 1", - "summary": { - "show_on_completion": false, - "collapsible": false - }, - "show_on_hub": true, - "groups": [ - { - "id": "group-1", - "blocks": [ - { - "id": "block-1", - "type": "Question", - "question": { - "id": "question-1", - "title": "How much did you spend on food?", - "type": "General", - "answers": [ - { - "id": "answer-1", - "mandatory": true, - "type": "Currency", - "label": "Money spent on food", - "description": "Enter the full value", - "minimum": { - "value": 0, - "exclusive": true - }, - "decimal_places": 2, - "currency": "GBP" - } - ] - } - }, - { - "id": "block-2", - "type": "Question", - "question": { - "id": "question-2", - "title": "Of the money spent on food, how much did you spend on vegetables?", - "type": "General", - "answers": [ - { - "id": "answer-2", - "mandatory": true, - "type": "Currency", - "label": "Money spent on vegetables", - "description": "Enter the full value", - "minimum": { - "value": 0, - "exclusive": true - }, - "maximum": { - "value": { - "identifier": "answer-1", - "source": "answers" - }, - "exclusive": false - }, - "decimal_places": 2, - "currency": "GBP" - } - ] - } - }, - { - "id": "block-3", - "type": "Question", - "question": { - "id": "question-3", - "title": "How much did you spend on clothes?", - "type": "General", - "answers": [ - { - "id": "answer-3", - "mandatory": true, - "type": "Currency", - "label": "Money spent on clothes", - "description": "Enter the full value", - "minimum": { - "value": 0, - "exclusive": true - }, - "decimal_places": 2, - "currency": "GBP" - } - ] - } - }, - { - "id": "block-4", - "type": "Question", - "question": { - "id": "question-4", - "title": "Of the money spent on clothes, how much did you spend on shoes?", - "type": "General", - "answers": [ - { - "id": "answer-4", - "mandatory": true, - "type": "Currency", - "label": "Money spent on shoes", - "description": "Enter the full value", - "minimum": { - "value": 0, - "exclusive": true - }, - "maximum": { - "value": { - "identifier": "answer-3", - "source": "answers" - }, - "exclusive": false - }, - "decimal_places": 2, - "currency": "GBP" - } - ] - } - }, - { - "id": "calculated-summary-block", - "type": "CalculatedSummary", - "title": "We have calculated your total spend to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "answer-1" - }, - { - "source": "answers", - "identifier": "answer-3" - } - ] - }, - "title": "Grand total of previous values" - } - } - ] - } - ] - } - ], - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ] -} diff --git a/schemas/test/en/test_new_calculated_summary_repeating_and_static_answers.json b/schemas/test/en/test_new_calculated_summary_repeating_and_static_answers.json deleted file mode 100644 index 0a8a3ae325..0000000000 --- a/schemas/test/en/test_new_calculated_summary_repeating_and_static_answers.json +++ /dev/null @@ -1,727 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Calculated Summary with Dynamic Answers", - "theme": "default", - "description": "A questionnaire to demo calculated summaries which use a list of repeating answers.", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { "required_completed_sections": ["section-1"] } - }, - "sections": [ - { - "id": "section-1", - "title": "Weekly Shopping", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "supermarkets", - "title": "Supermarkets", - "add_link_text": "Add another supermarket", - "empty_list_text": "There are no supermarkets" - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "group", - "blocks": [ - { - "type": "ListCollectorDrivingQuestion", - "id": "any-supermarket", - "for_list": "supermarkets", - "question": { - "type": "General", - "id": "any-supermarket-question", - "title": "Do you visit any supermarkets for your weekly shopping?", - "answers": [ - { - "type": "Radio", - "id": "any-supermarket-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-supermarket", - "list_name": "supermarkets" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "section": "End", - "when": { - "==": [ - { - "source": "answers", - "identifier": "any-supermarket-answer" - }, - "No" - ] - } - }, - { - "block": "list-collector" - } - ] - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "supermarkets", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Do you need to add any more supermarkets?", - "answers": [ - { - "id": "list-collector-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-supermarket", - "type": "ListAddQuestion", - "cancel_text": "Don’t need to add any other supermarkets?", - "question": { - "id": "add-question", - "type": "General", - "title": "Which supermarkets do you use for your weekly shopping?", - "answers": [ - { - "id": "supermarket-name", - "label": "Supermarket", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-supermarket", - "type": "ListEditQuestion", - "cancel_text": "Don’t need to change anything?", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the supermarket?", - "answers": [ - { - "id": "supermarket-name", - "label": "Supermarket", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-supermarket", - "type": "ListRemoveQuestion", - "cancel_text": "Don’t need to remove this supermarket?", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this supermarket?", - "warning": "All of the information about this supermarket will be deleted", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Supermarkets", - "item_title": { - "text": "{supermarket_name}", - "placeholders": [ - { - "placeholder": "supermarket_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "supermarket-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "type": "Question", - "id": "dynamic-answer", - "skip_conditions": { - "when": { - "==": [ - { - "count": [ - { - "source": "list", - "identifier": "supermarkets" - } - ] - }, - 0 - ] - } - }, - "question": { - "dynamic_answers": { - "values": { - "source": "list", - "identifier": "supermarkets" - }, - "answers": [ - { - "label": { - "text": "How much do you spend on groceries at {transformed_value}?", - "placeholders": [ - { - "placeholder": "transformed_value", - "value": { - "source": "answers", - "identifier": "supermarket-name" - } - } - ] - }, - "id": "cost-of-shopping", - "type": "Currency", - "mandatory": true, - "currency": "GBP", - "decimal_places": 2 - }, - { - "label": { - "text": "How much do you spend on other items at {transformed_value}?", - "placeholders": [ - { - "placeholder": "transformed_value", - "value": { - "source": "answers", - "identifier": "supermarket-name" - } - } - ] - }, - "id": "cost-of-other", - "type": "Currency", - "mandatory": true, - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "days-a-week", - "label": { - "text": "How many days a week do you shop at {transformed_value}?", - "placeholders": [ - { - "placeholder": "transformed_value", - "value": { - "source": "answers", - "identifier": "supermarket-name" - } - } - ] - }, - "mandatory": false, - "type": "Number", - "decimal_places": 0, - "minimum": { - "value": 1 - }, - "maximum": { - "value": 7 - } - } - ] - }, - "answers": [ - { - "id": "based-checkbox-answer", - "label": "Are supermarkets UK or non UK based?", - "instruction": "Select any answers that apply", - "mandatory": false, - "options": [ - { - "label": "UK based supermarkets", - "value": "UK based supermarkets" - }, - { - "label": "Non UK based supermarkets", - "value": "Non UK based supermarkets" - } - ], - "type": "Checkbox" - }, - { - "id": "extra-static-answer", - "label": "How much do you spend on food at other types of shop?", - "type": "Currency", - "mandatory": false, - "currency": "GBP", - "decimal_places": 2 - } - ], - "id": "dynamic-answer-question", - "title": "How much do you spend each week at each of the following supermarket?", - "type": "General" - } - }, - { - "type": "Question", - "id": "extra-spending-block", - "question": { - "id": "extra-spending-question", - "title": "How much extra money do you spend each week on online food shopping?", - "type": "General", - "guidance": { - "contents": [ - { - "title": "How to test", - "list": [ - "If you enter a value other than £0 an additional question opens up.", - "Test that if you answer £0 to this question and then edit the answer from the calculated summary change link", - "First you are taken to the new question which opens up (provided it isn’t already complete), and only then back to the calculated summary" - ] - } - ] - }, - "answers": [ - { - "id": "extra-spending-answer", - "label": "Online food shopping expenditure", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "extra-spending-method-block", - "skip_conditions": { - "when": { - "==": [ - { - "source": "answers", - "identifier": "extra-spending-answer" - }, - 0 - ] - } - }, - "question": { - "id": "extra-spending-method-question", - "title": "Do you use a mobile phone to do online food shopping?", - "type": "General", - "answers": [ - { - "id": "extra-spending-method-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-spending", - "title": "We calculate the total cost of your weekly shopping to be %(total)s. Is this correct?", - "calculation": { - "title": "Weekly shopping cost", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "cost-of-shopping" - }, - { - "source": "answers", - "identifier": "cost-of-other" - }, - { - "source": "answers", - "identifier": "extra-spending-answer" - }, - { - "source": "answers", - "identifier": "extra-static-answer" - } - ] - } - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-visits", - "title": "We calculate the total visits to the shop to be %(total)s. Is this correct?", - "calculation": { - "title": "Weekly shopping trips", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "days-a-week" - } - ] - } - } - } - ] - } - ] - }, - { - "id": "section-2", - "title": "Shopping Details", - "enabled": { - "when": { - ">": [ - { - "source": "calculated_summary", - "identifier": "calculated-summary-spending" - }, - 0 - ] - } - }, - "groups": [ - { - "id": "group-2", - "blocks": [ - { - "type": "Question", - "id": "supermarket-transport", - "question": { - "id": "weekly-car-trips-question", - "title": { - "placeholders": [ - { - "placeholder": "total_visits", - "value": { - "identifier": "calculated-summary-visits", - "source": "calculated_summary" - } - } - ], - "text": "On how many of your {total_visits} weekly shopping trips do you travel by car?" - }, - "type": "General", - "answers": [ - { - "id": "weekly-car-trips-answer", - "label": "Number of visits by car", - "mandatory": true, - "description": "Cannot exceed the total weekly trips from section 1", - "type": "Number", - "decimal_places": 0, - "maximum": { - "value": { - "source": "calculated_summary", - "identifier": "calculated-summary-visits" - } - } - } - ] - } - }, - { - "type": "Question", - "id": "supermarket-transport-cost", - "skip_conditions": { - "when": { - "==": [ - { - "source": "answers", - "identifier": "weekly-car-trips-answer" - }, - 0 - ] - } - }, - "question": { - "id": "weekly-trips-cost", - "title": "How much do you spend on parking when travelling to the shop by car?", - "type": "General", - "answers": [ - { - "id": "weekly-trips-cost-answer", - "label": "Weekly spending on parking", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Interstitial", - "id": "calculated-summary-piping", - "content_variants": [ - { - "content": { - "title": "You have provided the following information about your weekly shop.", - "contents": [ - { - "list": [ - { - "text": "Total weekly supermarket spending: {currency_total}", - "placeholders": [ - { - "placeholder": "currency_total", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "source": "calculated_summary", - "identifier": "calculated-summary-spending" - } - } - } - ] - } - ] - }, - { - "text": "Total weekly supermarket visits: {number_total}", - "placeholders": [ - { - "placeholder": "number_total", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "calculated_summary", - "identifier": "calculated-summary-visits" - } - } - } - ] - } - ] - }, - { - "text": "Total of supermarket visits by car: {number_total}", - "placeholders": [ - { - "placeholder": "number_total", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "answers", - "identifier": "weekly-car-trips-answer" - } - } - } - ] - } - ] - } - ] - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "weekly-car-trips-answer" - }, - 0 - ] - } - }, - { - "content": { - "title": "You have provided the following information about your weekly shop.", - "contents": [ - { - "list": [ - { - "text": "Total weekly supermarket spending: {currency_total}", - "placeholders": [ - { - "placeholder": "currency_total", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "source": "calculated_summary", - "identifier": "calculated-summary-spending" - } - } - } - ] - } - ] - }, - { - "text": "Total weekly supermarket visits: {number_total}", - "placeholders": [ - { - "placeholder": "number_total", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "calculated_summary", - "identifier": "calculated-summary-visits" - } - } - } - ] - } - ] - }, - { - "text": "Total of supermarket visits by car: {number_total}", - "placeholders": [ - { - "placeholder": "number_total", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "answers", - "identifier": "weekly-car-trips-answer" - } - } - } - ] - } - ] - }, - { - "text": "Total spending on parking: {currency_total}", - "placeholders": [ - { - "placeholder": "currency_total", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "source": "answers", - "identifier": "weekly-trips-cost-answer" - } - } - } - ] - } - ] - } - ] - } - ] - }, - "when": { - ">": [ - { - "source": "answers", - "identifier": "weekly-car-trips-answer" - }, - 0 - ] - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_new_calculated_summary_repeating_answers_only.json b/schemas/test/en/test_new_calculated_summary_repeating_answers_only.json deleted file mode 100644 index 40a6de8f9f..0000000000 --- a/schemas/test/en/test_new_calculated_summary_repeating_answers_only.json +++ /dev/null @@ -1,322 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Calculated Summary with Dynamic Answers", - "theme": "default", - "description": "A simple demo of a calculated summary which uses a list of repeating answers.", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": {} - }, - "sections": [ - { - "id": "section", - "title": "List Collector Section", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "transport", - "title": "Transport", - "add_link_text": "Add another method of transport", - "empty_list_text": "There are no uses of public transport" - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "group", - "blocks": [ - { - "type": "ListCollectorDrivingQuestion", - "id": "any-transport", - "for_list": "transport", - "question": { - "type": "General", - "id": "any-transport-question", - "title": "Do you use public transport?", - "answers": [ - { - "type": "Radio", - "id": "any-transport-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-transport", - "list_name": "transport" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "section": "End", - "when": { - "==": [ - { - "source": "answers", - "identifier": "any-transport-answer" - }, - "No" - ] - } - }, - { - "block": "list-collector" - } - ] - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "transport", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Do you need to add any more types of transport?", - "answers": [ - { - "id": "list-collector-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-transport", - "type": "ListAddQuestion", - "cancel_text": "Don’t need to add any other type of transport?", - "question": { - "id": "add-question", - "type": "General", - "title": "Which types of public transport do you use?", - "answers": [ - { - "id": "transport-name", - "label": "Transport type", - "mandatory": true, - "type": "Dropdown", - "options": [ - { - "label": "Train", - "value": "Train" - }, - { - "label": "Bus", - "value": "Bus" - }, - { - "label": "Tube", - "value": "Tube" - } - ] - } - ] - } - }, - "edit_block": { - "id": "edit-transport", - "type": "ListEditQuestion", - "cancel_text": "Don’t need to change anything?", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the type of public transport?", - "answers": [ - { - "id": "transport-name", - "label": "Transport type", - "mandatory": true, - "type": "Dropdown", - "options": [ - { - "label": "Train", - "value": "Train" - }, - { - "label": "Bus", - "value": "Bus" - }, - { - "label": "Tube", - "value": "Tube" - } - ] - } - ] - } - }, - "remove_block": { - "id": "remove-transport", - "type": "ListRemoveQuestion", - "cancel_text": "Don’t need to remove this method of transport?", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this method of transport?", - "warning": "All of the information about this method of transport will be deleted", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "transport", - "item_title": { - "text": "{transport_name}", - "placeholders": [ - { - "placeholder": "transport_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "transport-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "type": "Question", - "id": "dynamic-answer", - "skip_conditions": { - "when": { - "==": [ - { - "count": [ - { - "source": "list", - "identifier": "transport" - } - ] - }, - 0 - ] - } - }, - "question": { - "dynamic_answers": { - "values": { - "source": "list", - "identifier": "transport" - }, - "answers": [ - { - "label": { - "text": "How much do you spend per month travelling by {transformed_value}?", - "placeholders": [ - { - "placeholder": "transformed_value", - "value": { - "source": "answers", - "identifier": "transport-name" - } - } - ] - }, - "id": "cost-of-transport", - "type": "Currency", - "mandatory": true, - "currency": "GBP", - "decimal_places": 2 - } - ] - }, - "id": "dynamic-answer-question", - "title": "How much do you spend per month on the following modes of public transport?", - "type": "General" - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-spending", - "title": "We calculate the total monthly spending on public transport to be %(total)s. Is this correct?", - "calculation": { - "title": "Monthly public transport spending", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "cost-of-transport" - } - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_new_calculated_summary_repeating_blocks.json b/schemas/test/en/test_new_calculated_summary_repeating_blocks.json deleted file mode 100644 index 249413b174..0000000000 --- a/schemas/test/en/test_new_calculated_summary_repeating_blocks.json +++ /dev/null @@ -1,521 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Calculated Summary of answers from Repeating blocks", - "theme": "default", - "description": "A demo of a calculated summary which uses a answers from the repeating blocks in a list collector.", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { - "required_completed_sections": ["section-1"] - } - }, - "sections": [ - { - "id": "section-1", - "title": "Transport", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "transport", - "title": "transport", - "item_anchor_answer_id": "transport-name", - "item_label": "Name of transport", - "add_link_text": "Add another method of transport", - "empty_list_text": "No method of transport added" - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "group-1", - "blocks": [ - { - "id": "block-car", - "type": "Question", - "question": { - "id": "question-car", - "type": "General", - "title": "How much do you spend per month travelling by Car?", - "answers": [ - { - "id": "answer-car", - "label": "Monthly expenditure travelling by car", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "id": "block-skip", - "type": "Question", - "question": { - "id": "question-skip", - "type": "General", - "title": "Would you like to skip the list collector that asks about other methods of transport?", - "guidance": { - "contents": [ - { - "description": "Use this to check the calculated summary shows the correct values when the list collector is not on the path." - } - ] - }, - "answers": [ - { - "id": "answer-skip", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "list-collector", - "when": { - "==": [ - { - "identifier": "answer-skip", - "source": "answers" - }, - "No" - ] - } - }, - { - "block": "calculated-summary-spending" - } - ] - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "transport", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Do you use any other methods of transport?", - "answers": [ - { - "id": "list-collector-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-transport", - "type": "ListAddQuestion", - "cancel_text": "Don’t need to add any other method of transport?", - "question": { - "id": "add-question", - "type": "General", - "title": "What other method of transport do you use?", - "answers": [ - { - "id": "transport-name", - "label": "Transport", - "mandatory": true, - "type": "Dropdown", - "options": [ - { - "label": "Tube", - "value": "Tube" - }, - { - "label": "Bus", - "value": "Bus" - }, - { - "label": "Train", - "value": "Train" - }, - { - "label": "Plane", - "value": "Plane" - } - ] - } - ] - } - }, - "edit_block": { - "id": "edit-transport", - "type": "ListEditQuestion", - "cancel_text": "Don’t need to add any other method of transport?", - "question": { - "id": "add-question", - "type": "General", - "title": "What other method of transport do you use?", - "answers": [ - { - "id": "transport-name", - "label": "Transport", - "mandatory": true, - "type": "Dropdown", - "options": [ - { - "label": "Tube", - "value": "Tube" - }, - { - "label": "Bus", - "value": "Bus" - }, - { - "label": "Train", - "value": "Train" - }, - { - "label": "Plane", - "value": "Plane" - } - ] - } - ] - } - }, - "remove_block": { - "id": "remove-transport", - "type": "ListRemoveQuestion", - "cancel_text": "Don’t need to remove this method of transport?", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this method of transport?", - "warning": "All of the information about this method of transport will be deleted", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "repeating_blocks": [ - { - "id": "transport-repeating-block-1", - "type": "ListRepeatingQuestion", - "question": { - "id": "transport-repeating-block-1-question", - "type": "General", - "title": { - "text": "Give details of your expenditure travelling by {transport_name}", - "placeholders": [ - { - "placeholder": "transport_name", - "value": { - "source": "answers", - "identifier": "transport-name" - } - } - ] - }, - "answers": [ - { - "id": "transport-company", - "label": { - "placeholders": [ - { - "placeholder": "transport_name", - "value": { - "source": "answers", - "identifier": "transport-name" - } - } - ], - "text": "Which company do primarily use for travelling by {transport_name}?" - }, - "mandatory": false, - "type": "TextField" - }, - { - "id": "transport-cost", - "label": { - "placeholders": [ - { - "placeholder": "transport_name", - "value": { - "source": "answers", - "identifier": "transport-name" - } - } - ], - "text": "Monthly season ticket expenditure for travel by {transport_name}" - }, - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "transport-additional-cost", - "label": { - "placeholders": [ - { - "placeholder": "transport_name", - "value": { - "source": "answers", - "identifier": "transport-name" - } - } - ], - "text": "Additional monthly expenditure for travel by {transport_name}" - }, - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "id": "transport-repeating-block-2", - "type": "ListRepeatingQuestion", - "question": { - "id": "transport-repeating-block-2-question-1", - "type": "General", - "title": { - "text": "How often do you travel by {transport_name}?", - "placeholders": [ - { - "placeholder": "transport_name", - "value": { - "source": "answers", - "identifier": "transport-name" - } - } - ] - }, - "answers": [ - { - "id": "transport-count", - "label": { - "placeholders": [ - { - "placeholder": "transport_name", - "value": { - "source": "answers", - "identifier": "transport-name" - } - } - ], - "text": "Monthly journeys by {transport_name}" - }, - "mandatory": false, - "type": "Number" - } - ] - } - } - ], - "summary": { - "title": "transport", - "item_title": { - "text": "{transport_name}", - "placeholders": [ - { - "placeholder": "transport_name", - "value": { - "source": "answers", - "identifier": "transport-name" - } - } - ] - } - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-spending", - "title": "We calculate the total monthly expenditure on transport to be %(total)s. Is this correct?", - "calculation": { - "title": "Monthly transport expenditure", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "answer-car" - }, - { - "source": "answers", - "identifier": "transport-cost" - }, - { - "source": "answers", - "identifier": "transport-additional-cost" - } - ] - } - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-count", - "title": "We calculate the total journeys made per month to be %(total)s. Is this correct?", - "calculation": { - "title": "Monthly journeys", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "transport-count" - } - ] - } - }, - "skip_conditions": { - "when": { - "or": [ - { - "==": [ - { - "count": [ - { - "source": "list", - "identifier": "transport" - } - ] - }, - 0 - ] - }, - { - "==": [ - { - "source": "answers", - "identifier": "answer-skip" - }, - "Yes" - ] - } - ] - } - } - } - ] - } - ] - }, - { - "enabled": { - "when": { - ">": [ - { - "source": "calculated_summary", - "identifier": "calculated-summary-count" - }, - 0 - ] - } - }, - "id": "section-2", - "summary": { - "show_on_completion": true - }, - "title": "Travel Details", - "groups": [ - { - "id": "group-2", - "blocks": [ - { - "type": "Question", - "id": "family-journeys", - "question": { - "id": "family-journeys-question", - "title": { - "placeholders": [ - { - "placeholder": "total_journeys", - "value": { - "identifier": "calculated-summary-count", - "source": "calculated_summary" - } - } - ], - "text": "How many of your {total_journeys} journeys are to visit family?" - }, - "type": "General", - "answers": [ - { - "id": "family-journeys-answer", - "label": "Number of trips to visit family", - "mandatory": true, - "description": "Cannot exceed the total journeys from section 1", - "type": "Number", - "maximum": { - "value": { - "source": "calculated_summary", - "identifier": "calculated-summary-count" - } - } - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_new_calculated_summary_repeating_section.json b/schemas/test/en/test_new_calculated_summary_repeating_section.json deleted file mode 100644 index a01eeb68cf..0000000000 --- a/schemas/test/en/test_new_calculated_summary_repeating_section.json +++ /dev/null @@ -1,820 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "A test schema to demo Calculated Summary", - "theme": "default", - "description": "A schema to showcase Calculated Summary pages and usage in value source in repeating sections", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section", - "title": "Household", - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "primary-person-list-collector", - "type": "PrimaryPersonListCollector", - "for_list": "people", - "add_or_edit_block": { - "id": "add-or-edit-primary-person", - "type": "PrimaryPersonListAddOrEditQuestion", - "question": { - "id": "primary-person-add-or-edit-question", - "type": "General", - "title": "What is your name?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "question": { - "id": "primary-confirmation-question", - "type": "General", - "title": "Do you live here?", - "answers": [ - { - "id": "you-live-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "personal-details-section", - "title": "Personal Details", - "summary": { - "show_on_completion": true - }, - "repeat": { - "for_list": "people", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "groups": [ - { - "id": "personal-details-group", - "title": "Personal Details", - "blocks": [ - { - "type": "Question", - "id": "first-number-block", - "question": { - "id": "first-number-question", - "title": "First Number Question Title", - "type": "General", - "answers": [ - { - "id": "first-number-answer", - "label": "First answer label", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "second-number-block", - "question": { - "id": "second-number-question", - "title": "Second Number Question Title", - "type": "General", - "answers": [ - { - "id": "second-number-answer", - "label": "Second answer in currency label", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "second-number-answer-unit-total", - "label": "Second answer label in unit total", - "mandatory": true, - "type": "Unit", - "unit_length": "short", - "unit": "length-centimeter" - }, - { - "id": "second-number-answer-also-in-total", - "label": "Second answer label also in currency total (optional)", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "third-number-block", - "question": { - "id": "third-number-question", - "title": "Third Number Question Title", - "type": "General", - "answers": [ - { - "id": "third-number-answer", - "label": "Third answer label", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "third-and-a-half-number-block", - "question": { - "id": "third-and-a-half-number-question-unit-total", - "title": "Third Number Question Title Unit Total", - "type": "General", - "answers": [ - { - "id": "third-and-a-half-number-answer-unit-total", - "label": "Third answer label in unit total", - "mandatory": true, - "type": "Unit", - "unit_length": "short", - "unit": "length-centimeter" - } - ] - } - }, - { - "type": "Question", - "id": "skip-fourth-block", - "question": { - "type": "General", - "id": "skip-fourth-block-question", - "title": "Skip Fourth Block so it doesn’t appear in Total?", - "answers": [ - { - "type": "Radio", - "id": "skip-fourth-block-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "skip-fourth-block-answer", - "source": "answers" - }, - "Yes" - ] - } - }, - "type": "Question", - "id": "fourth-number-block", - "question": { - "id": "fourth-number-question", - "title": "Fourth Number Question Title", - "type": "General", - "answers": [ - { - "id": "fourth-number-answer", - "label": "Fourth answer label (optional)", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "skip-fourth-block-answer", - "source": "answers" - }, - "Yes" - ] - } - }, - "type": "Question", - "id": "fourth-and-a-half-number-block", - "question": { - "id": "fourth-and-a-half-number-question-also-in-total", - "title": "Fourth Number Additional Question Title", - "type": "General", - "answers": [ - { - "id": "fourth-and-a-half-number-answer-also-in-total", - "label": "Fourth answer label also in total (optional)", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "fifth-number-block", - "question": { - "id": "fifth-number-question", - "title": "Fifth Number Question Title Percentage", - "type": "General", - "answers": [ - { - "id": "fifth-percent-answer", - "label": "Fifth answer label percentage total", - "mandatory": true, - "type": "Percentage", - "maximum": { - "value": 100 - } - }, - { - "id": "fifth-number-answer", - "label": "Fifth answer label number total", - "mandatory": false, - "type": "Number", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "sixth-number-block", - "question": { - "id": "sixth-number-question", - "title": "Sixth Number Question Title Percentage", - "type": "General", - "answers": [ - { - "id": "sixth-percent-answer", - "label": "Sixth answer label percentage total", - "mandatory": true, - "type": "Percentage", - "maximum": { - "value": 100 - } - }, - { - "id": "sixth-number-answer", - "label": "Sixth answer label number total", - "mandatory": false, - "type": "Number", - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "currency-total-playback", - "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "first-number-answer" - }, - { - "source": "answers", - "identifier": "second-number-answer" - }, - { - "source": "answers", - "identifier": "second-number-answer-also-in-total" - }, - { - "source": "answers", - "identifier": "third-number-answer" - }, - { - "source": "answers", - "identifier": "fourth-number-answer" - }, - { - "source": "answers", - "identifier": "fourth-and-a-half-number-answer-also-in-total" - } - ] - }, - "title": "Grand total of previous values" - } - }, - { - "type": "CalculatedSummary", - "id": "unit-total-playback", - "title": "We calculate the total of unit values entered to be %(total)s. Is this correct?", - "page_title": "Total Unit Values", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "second-number-answer-unit-total" - }, - { - "source": "answers", - "identifier": "third-and-a-half-number-answer-unit-total" - } - ] - }, - "title": "Grand total of previous values" - } - }, - { - "type": "CalculatedSummary", - "id": "percentage-total-playback", - "title": "We calculate the total of percentage values entered to be %(total)s. Is this correct?", - "page_title": "Percentage Calculated Summary: Person {list_item_position}", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "fifth-percent-answer" - }, - { - "source": "answers", - "identifier": "sixth-percent-answer" - } - ] - }, - "title": "Grand total of previous values" - } - }, - { - "type": "CalculatedSummary", - "id": "number-total-playback", - "title": "We calculate the total of number values entered to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "fifth-number-answer" - }, - { - "source": "answers", - "identifier": "sixth-number-answer" - } - ] - }, - "title": "Grand total of previous values" - } - }, - { - "id": "breakdown", - "type": "Question", - "question": { - "id": "breakdown-question", - "title": { - "text": "Enter two values that add up to the previous calculated summary total of {total_first}", - "placeholders": [ - { - "placeholder": "total_first", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "identifier": "number-total-playback", - "source": "calculated_summary" - } - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "breakdown-answer-1", - "mandatory": false, - "type": "Currency", - "label": "First Value", - "decimal_places": 2, - "currency": "GBP" - }, - { - "id": "breakdown-answer-2", - "mandatory": false, - "type": "Currency", - "label": "Second Value", - "decimal_places": 2, - "currency": "GBP" - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "second-currency-total-playback", - "title": "We calculate the total of number values entered to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "breakdown-answer-1" - }, - { - "source": "answers", - "identifier": "breakdown-answer-2" - } - ] - }, - "title": "Grand total of previous values" - } - }, - { - "type": "Interstitial", - "id": "calculated-summary-total-confirmation", - "content": { - "title": "You have provided the following grand totals.", - "contents": [ - { - "list": [ - { - "text": "Total currency values: {currency_total}", - "placeholders": [ - { - "placeholder": "currency_total", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "source": "calculated_summary", - "identifier": "currency-total-playback" - } - } - } - ] - } - ] - }, - { - "text": "Total unit values: {unit_total}", - "placeholders": [ - { - "placeholder": "unit_total", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "calculated_summary", - "identifier": "unit-total-playback" - } - } - } - ] - } - ] - }, - { - "text": "Total percentage values: {percentage_total}", - "placeholders": [ - { - "placeholder": "percentage_total", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "calculated_summary", - "identifier": "percentage-total-playback" - } - } - } - ] - } - ] - }, - { - "text": "Total number values: {number_total}", - "placeholders": [ - { - "placeholder": "number_total", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "calculated_summary", - "identifier": "number-total-playback" - } - } - } - ] - } - ] - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "set-min-max-block", - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "skip-fourth-block-answer", - "source": "answers" - }, - "No" - ] - } - }, - "question": { - "answers": [ - { - "id": "set-minimum-answer", - "label": "Set a value greater than the total above", - "mandatory": true, - "description": "This is a description of the minimum value", - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "minimum": { - "value": { - "source": "calculated_summary", - "identifier": "currency-total-playback" - } - } - }, - { - "id": "set-maximum-answer", - "description": "This is a description of the maximum value", - "label": "Set a value less than the total above", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "maximum": { - "value": { - "source": "calculated_summary", - "identifier": "currency-total-playback" - } - } - } - ], - "id": "set-min-question", - "title": { - "placeholders": [ - { - "placeholder": "calculated_summary_answer", - "value": { - "identifier": "currency-total-playback", - "source": "calculated_summary" - } - } - ], - "text": "Set minimum and maximum values based on your calculated summary total of £{calculated_summary_answer}" - }, - "type": "General" - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_numbers.json b/schemas/test/en/test_numbers.json deleted file mode 100644 index 195f2ea576..0000000000 --- a/schemas/test/en/test_numbers.json +++ /dev/null @@ -1,547 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "023", - "title": "Test Numeric Range", - "description": "Test Description", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "set-min-max-block", - "question": { - "answers": [ - { - "id": "set-minimum", - "label": "Minimum Value", - "description": "This is a description of the minimum value", - "mandatory": true, - "type": "Number", - "decimal_places": 2, - "minimum": { - "value": -1000.98 - }, - "maximum": { - "value": 1000 - } - }, - { - "id": "set-maximum", - "description": "This is a description of the maximum value", - "label": "Maximum Value", - "mandatory": true, - "type": "Number", - "decimal_places": 2, - "minimum": { - "value": 1001 - }, - "maximum": { - "value": 10000.98 - } - } - ], - "id": "set-min-question", - "title": "Please set the minimum and maximum used for future questions", - "type": "General" - } - }, - { - "type": "Question", - "id": "test-min-max-block", - "question": { - "answers": [ - { - "id": "test-range", - "label": "Range Test", - "description": { - "text": "Range Test ({minimum} to {maximum})", - "placeholders": [ - { - "placeholder": "minimum", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "answers", - "identifier": "set-minimum" - } - } - } - ] - }, - { - "placeholder": "maximum", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "answers", - "identifier": "set-maximum" - } - } - } - ] - } - ] - }, - "mandatory": true, - "type": "Number", - "decimal_places": 2, - "maximum": { - "value": { - "source": "answers", - "identifier": "set-maximum" - } - }, - "minimum": { - "value": { - "source": "answers", - "identifier": "set-minimum" - } - } - }, - { - "id": "test-range-exclusive", - "label": "Range Exclusive Test", - "description": { - "text": "Range Exclusive Test ({minimum} to {maximum} Exclusive)", - "placeholders": [ - { - "placeholder": "minimum", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "answers", - "identifier": "set-minimum" - } - } - } - ] - }, - { - "placeholder": "maximum", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "answers", - "identifier": "set-maximum" - } - } - } - ] - } - ] - }, - "mandatory": false, - "type": "Number", - "decimal_places": 2, - "maximum": { - "value": { - "source": "answers", - "identifier": "set-maximum" - }, - "exclusive": true - }, - "minimum": { - "value": { - "source": "answers", - "identifier": "set-minimum" - }, - "exclusive": true - } - }, - { - "id": "test-min", - "label": "Min Test (-123 to 999,999,999,999,999)", - "mandatory": false, - "type": "Number", - "minimum": { - "value": -123 - } - }, - { - "id": "test-max", - "label": "Max Test (0 to 1,234)", - "mandatory": false, - "type": "Number", - "maximum": { - "value": 1234 - } - }, - { - "id": "test-min-exclusive", - "label": "Min Exclusive Test (124 to 999,999,999,999,999 - 123 Exclusive)", - "mandatory": false, - "type": "Number", - "minimum": { - "value": 123, - "exclusive": true - } - }, - { - "id": "test-max-exclusive", - "label": "Max Exclusive Test (0 to 1,233 - 1,234 Exclusive)", - "mandatory": false, - "type": "Number", - "maximum": { - "value": 1234, - "exclusive": true - } - }, - { - "id": "test-percent", - "label": "Percent Test (0 to 100)", - "mandatory": false, - "type": "Percentage", - "maximum": { - "value": 100 - } - }, - { - "id": "test-decimal", - "label": "Decimal Test", - "description": { - "text": "Range Exclusive Test ({minimum} to {maximum} Exclusive)", - "placeholders": [ - { - "placeholder": "minimum", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "answers", - "identifier": "set-minimum" - } - } - } - ] - }, - { - "placeholder": "maximum", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "answers", - "identifier": "set-maximum" - } - } - } - ] - } - ] - }, - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 5, - "maximum": { - "value": { - "source": "answers", - "identifier": "set-maximum" - } - }, - "minimum": { - "value": { - "source": "answers", - "identifier": "set-minimum" - } - } - } - ], - "id": "test-min-max-range-question", - "title": "Please enter test values (none mandatory)", - "type": "General" - } - }, - { - "type": "Question", - "id": "detail-answer-block", - "question": { - "answers": [ - { - "id": "detail-answer", - "mandatory": true, - "options": [ - { - "label": "1", - "value": "1" - }, - { - "label": "2", - "value": "2" - }, - { - "label": "Other", - "value": "Other", - "detail_answer": { - "mandatory": false, - "id": "other-answer", - "label": "Please specify other", - "type": "Number", - "maximum": { - "value": { - "source": "answers", - "identifier": "test-range" - } - } - } - } - ], - "type": "Checkbox" - } - ], - "id": "detail-answer-question", - "title": { - "text": "Please enter test values for detail answer Less or equal than {maximum}", - "placeholders": [ - { - "placeholder": "maximum", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "answers", - "identifier": "test-range" - } - } - } - ] - } - ] - }, - "type": "General" - } - } - ], - "id": "test" - } - ] - }, - { - "id": "currency-section", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "currency-group", - "title": "Section Summary With Variants", - "blocks": [ - { - "type": "Question", - "id": "currency-block", - "question": { - "id": "currency-question", - "type": "General", - "title": "What currency would you like", - "answers": [ - { - "id": "currency-answer", - "type": "Radio", - "mandatory": true, - "options": [ - { - "label": "US Dollars", - "value": "US Dollars" - }, - { - "label": "Sterling", - "value": "Sterling" - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "first-number-block", - "question_variants": [ - { - "question": { - "id": "first-number-question", - "title": "First Number Question Title", - "type": "General", - "answers": [ - { - "id": "first-number-answer", - "label": "First answer in GBP", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "maximum": { - "value": 1000 - }, - "minimum": { - "value": 1 - } - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "currency-answer" - }, - "Sterling" - ] - } - }, - { - "question": { - "id": "first-number-question", - "title": "First Number Question Title", - "type": "General", - "answers": [ - { - "id": "first-number-answer", - "label": "First answer in USD", - "mandatory": true, - "type": "Currency", - "currency": "USD", - "decimal_places": 2, - "maximum": { - "value": 100 - }, - "minimum": { - "value": 10 - } - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "currency-answer" - }, - "US Dollars" - ] - } - } - ] - }, - { - "type": "Question", - "id": "second-number-block", - "question_variants": [ - { - "question": { - "id": "second-number-question", - "title": "Second Number Question Title", - "type": "General", - "answers": [ - { - "id": "second-number-answer", - "label": "Second answer in GBP", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "maximum": { - "value": { - "source": "answers", - "identifier": "first-number-answer" - } - }, - "minimum": { - "value": { - "source": "answers", - "identifier": "first-number-answer" - } - } - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "currency-answer" - }, - "Sterling" - ] - } - }, - { - "question": { - "id": "second-number-question", - "title": "Second Number Question Title", - "type": "General", - "answers": [ - { - "id": "second-number-answer", - "label": "Second answer in USD", - "mandatory": true, - "type": "Currency", - "currency": "USD", - "decimal_places": 2, - "maximum": { - "value": { - "source": "answers", - "identifier": "set-maximum" - } - }, - "minimum": { - "value": 100 - } - } - ] - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "currency-answer" - }, - "US Dollars" - ] - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_optional_guidance_and_description.json b/schemas/test/en/test_optional_guidance_and_description.json deleted file mode 100644 index 38cdb32f44..0000000000 --- a/schemas/test/en/test_optional_guidance_and_description.json +++ /dev/null @@ -1,219 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Other input fields", - "theme": "default", - "description": "A questionnaire to demo optional question guidance and descriptions", - "metadata": [ - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "user_id", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "description-block", - "question": { - "answers": [ - { - "id": "answer-1", - "label": "Enter any description text that you want to be displayed", - "max_length": 20, - "mandatory": false, - "type": "TextField" - }, - { - "id": "answer-2", - "label": "Enter any alternative text that you want to be displayed", - "max_length": 20, - "mandatory": false, - "type": "TextField" - } - ], - "description": [ - "If entered, only one of the text fields will be used for the description as the next question uses the first_non_empty_item placeholder" - ], - "id": "description-question", - "title": "Do not enter anything here so you get an empty question description and question guidance on the following pages!", - "type": "General" - } - }, - { - "type": "Question", - "id": "mandatory-radio", - "question": { - "guidance": { - "contents": [ - { - "description": { - "text": "{description_text}", - "placeholders": [ - { - "placeholder": "description_text", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "answers", - "identifier": "answer-1" - }, - { - "source": "answers", - "identifier": "answer-2" - } - ] - } - } - ] - } - ] - } - } - ] - }, - "description": [ - { - "text": "{description_text}", - "placeholders": [ - { - "placeholder": "description_text", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "answers", - "identifier": "answer-1" - }, - { - "source": "answers", - "identifier": "answer-2" - } - ] - } - } - ] - } - ] - } - ], - "answers": [ - { - "id": "mandatory-radio-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "mandatory-radio-question", - "title": "Were the question description and guidance displayed?", - "type": "General" - } - }, - { - "type": "Question", - "id": "mandatory-radio-two", - "question": { - "guidance": { - "contents": [ - { - "description": "Description with an empty content list" - }, - { - "list": [ - "List item one", - { - "text": "{description_text}", - "placeholders": [ - { - "placeholder": "description_text", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "answers", - "identifier": "answer-1" - }, - { - "source": "answers", - "identifier": "answer-2" - } - ] - } - } - ] - } - ] - } - ] - } - ] - }, - "answers": [ - { - "id": "mandatory-radio-answer-two", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "mandatory-radio-question-two", - "title": "Was the contents list in the question guidance displayed?", - "type": "General" - } - } - ], - "id": "radios" - } - ] - } - ] -} diff --git a/schemas/test/en/test_percentage.json b/schemas/test/en/test_percentage.json deleted file mode 100644 index 29d9c586d4..0000000000 --- a/schemas/test/en/test_percentage.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Percentage Field Demo", - "theme": "default", - "description": "A questionnaire to test percentage input type", - "navigation": { - "visible": true - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "percent-input-section", - "title": "Percent Input", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "block", - "question": { - "answers": [ - { - "description": "Enter percentage of growth", - "id": "answer", - "label": "New to the market 2012-2014", - "mandatory": false, - "type": "Percentage", - "maximum": { - "value": 100 - } - } - ], - "id": "question", - "title": "Enter a percentage", - "type": "General" - } - }, - { - "type": "Question", - "id": "block-decimal", - "question": { - "answers": [ - { - "description": "Enter percentage of growth", - "id": "answer-decimal", - "label": "New to the market 2012-2014", - "mandatory": false, - "type": "Percentage", - "maximum": { - "value": 100 - }, - "decimal_places": 3 - } - ], - "id": "question-decimal", - "title": "Enter a percentage with up to 3 decimal places", - "type": "General" - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_placeholder_based_on_first_item_in_list.json b/schemas/test/en/test_placeholder_based_on_first_item_in_list.json deleted file mode 100644 index 5b6a1543b0..0000000000 --- a/schemas/test/en/test_placeholder_based_on_first_item_in_list.json +++ /dev/null @@ -1,386 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Repeating Section Summaries", - "theme": "default", - "description": "A questionnaire to repeating section summary functionality", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section", - "title": "Household", - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "personal-details-section", - "title": "Personal Details", - "summary": { - "show_on_completion": true - }, - "repeat": { - "for_list": "people", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "groups": [ - { - "id": "personal-details-group", - "title": "Personal Details", - "blocks": [ - { - "content_variants": [ - { - "content": { - "contents": [ - { - "description": "You are the first person in the list" - } - ], - "title": "List Status" - }, - "when": { - "==": [ - { - "identifier": "people", - "source": "list", - "selector": "first" - }, - { - "source": "location", - "identifier": "list_item_id" - } - ] - } - }, - { - "content": { - "contents": [ - { - "description": "You are not the first person in the list" - } - ], - "title": "List Status" - }, - "when": { - "!=": [ - { - "identifier": "people", - "source": "list", - "selector": "first" - }, - { - "source": "location", - "identifier": "list_item_id" - } - ] - } - } - ], - "id": "list-status", - "type": "Interstitial" - }, - { - "type": "Question", - "id": "favourite-drink", - "question": { - "answers": [ - { - "id": "favourite-drink-answer", - "label": "What is your favourite drink", - "max_length": 20, - "mandatory": false, - "type": "TextField" - } - ], - "id": "favourite-drink-question", - "title": "Title", - "type": "General" - } - }, - { - "id": "list-status-2", - "question_variants": [ - { - "question": { - "answers": [ - { - "id": "list-status-answer-2", - "mandatory": false, - "options": [ - { - "label": "Tea", - "value": "Tea" - }, - { - "label": "Coffee", - "value": "Coffee" - } - ], - "type": "Radio" - } - ], - "id": "list-status-question-2", - "title": "What is your second favourite drink?", - "type": "General" - }, - "when": { - "==": [ - { - "identifier": "people", - "source": "list", - "selector": "first" - }, - { - "source": "location", - "identifier": "list_item_id" - } - ] - } - }, - { - "question": { - "answers": [ - { - "id": "list-status-answer-2", - "mandatory": false, - "options": [ - { - "label": { - "text": "{answer}", - "placeholders": [ - { - "placeholder": "answer", - "value": { - "source": "answers", - "identifier": "favourite-drink-answer", - "list_item_selector": { - "source": "list", - "identifier": "people", - "selector": "first" - } - } - } - ] - }, - "value": "{answer}" - }, - { - "label": "Other", - "value": "Other" - } - ], - "type": "Radio" - } - ], - "id": "list-status-question-2", - "title": "What is your second favourite drink?", - "type": "General" - }, - "when": { - "!=": [ - { - "identifier": "people", - "source": "list", - "selector": "first" - }, - { - "source": "location", - "identifier": "list_item_id" - } - ] - } - } - ], - "type": "Question" - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_placeholder_default_value.json b/schemas/test/en/test_placeholder_default_value.json deleted file mode 100644 index 227ab461bd..0000000000 --- a/schemas/test/en/test_placeholder_default_value.json +++ /dev/null @@ -1,169 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Placeholder default value", - "theme": "default", - "description": "A questionnaire to demo Placeholder default value.", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "employees-number-block", - "question": { - "answers": [ - { - "id": "employees-no", - "mandatory": false, - "decimal_places": 0, - "type": "Number", - "label": "Total number of employees", - "default": 0 - } - ], - "id": "employees-no-question", - "title": { - "text": "What is the number of employees for the {ru_name} ?", - "placeholders": [ - { - "placeholder": "ru_name", - "value": { - "source": "metadata", - "identifier": "ru_name" - } - } - ] - }, - "guidance": { - "contents": [ - { - "description": "Leave the text box blank to see the default value on the next page" - } - ] - }, - "type": "General" - } - }, - { - "id": "employees-number-interstitial", - "content": { - "title": "Employees number interstitial", - "contents": [ - { - "description": { - "text": "The total number of employees confirmed are {answer_employee} , now next question is about training budget", - "placeholders": [ - { - "placeholder": "answer_employee", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "answers", - "identifier": "employees-no" - } - } - } - ] - } - ] - } - } - ] - }, - "type": "Interstitial" - }, - { - "type": "Question", - "id": "employees-training-block", - "question": { - "answers": [ - { - "id": "employees-avg-training", - "mandatory": false, - "decimal_places": 2, - "type": "Currency", - "currency": "GBP", - "label": "Training Budget", - "default": 250 - } - ], - "id": "employees-training-question", - "title": "What is average training budget per employee ?", - "guidance": { - "contents": [ - { - "description": "Leave the text box blank to see the default value on the next page" - } - ] - }, - "type": "General" - } - }, - { - "id": "employees-training-interstitial", - "content": { - "title": "Employee training budget interstitial", - "contents": [ - { - "description": { - "text": "The average training budget per employee is {answer_emp_training}", - "placeholders": [ - { - "placeholder": "answer_emp_training", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "source": "answers", - "identifier": "employees-avg-training" - } - } - } - ] - } - ] - } - } - ] - }, - "type": "Interstitial" - } - ], - "id": "employee-count", - "title": "Employee count" - } - ] - } - ] -} diff --git a/schemas/test/en/test_placeholder_dependencies_with_calculation_summaries.json b/schemas/test/en/test_placeholder_dependencies_with_calculation_summaries.json deleted file mode 100644 index 24e4fe25fb..0000000000 --- a/schemas/test/en/test_placeholder_dependencies_with_calculation_summaries.json +++ /dev/null @@ -1,647 +0,0 @@ -{ - "language": "en", - "mime_type": "application/json/ons/eq", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test placeholder dependencies in calculated summary pages", - "questionnaire_flow": { - "type": "Hub", - "options": { - "required_completed_sections": ["reporting-period-section"] - } - }, - "sections": [ - { - "id": "reporting-period-section", - "title": "Reporting period", - "summary": { - "show_on_completion": false, - "page_title": "Reporting period", - "collapsible": false - }, - "show_on_hub": true, - "groups": [ - { - "id": "reporting-period-group", - "blocks": [ - { - "id": "reporting-date", - "type": "Question", - "question": { - "id": "reporting-date-question", - "title": { - "text": "Are you able to report for the calendar year, {ref_p_start_date} to {ref_p_end_date}?", - "placeholders": [ - { - "placeholder": "ref_p_start_date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "ref_p_end_date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_end_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "reporting-date-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes, I can report for this period", - "value": "Yes, I can report for this period" - }, - { - "label": "No, I need to report for a different period", - "value": "No, I need to report for a different period" - } - ] - } - ] - }, - "page_title": "Calendar year reporting period", - "routing_rules": [ - { - "block": "undertake-rnd", - "when": { - "in": [ - { - "identifier": "reporting-date-answer", - "source": "answers" - }, - ["Yes, I can report for this period"] - ] - } - }, - { - "block": "enter-dates" - } - ] - }, - { - "id": "enter-dates", - "type": "Question", - "question": { - "id": "enter-dates-question", - "title": "What dates will you be reporting for?", - "type": "DateRange", - "answers": [ - { - "id": "date-from", - "type": "Date", - "mandatory": true, - "label": "From" - }, - { - "id": "date-to", - "type": "Date", - "mandatory": true, - "label": "To" - } - ], - "period_limits": { - "minimum": { - "months": 3 - }, - "maximum": { - "months": 18 - } - } - }, - "page_title": "Alternative reporting period" - }, - { - "id": "undertake-rnd", - "type": "Question", - "question": { - "id": "undertake-rnd-question", - "title": "For the reporting period, did your business undertake any in-house R&D?", - "type": "General", - "answers": [ - { - "id": "undertake-rnd-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "page_title": "In-house R&D for reporting period" - } - ] - } - ] - }, - { - "id": "questions-section", - "title": "In-house R&D", - "summary": { - "show_on_completion": false, - "page_title": "In-house R&D", - "collapsible": false - }, - "show_on_hub": true, - "groups": [ - { - "id": "questions-group", - "blocks": [ - { - "id": "how-much-rnd", - "type": "Question", - "question": { - "id": "how-much-rnd-question", - "title": { - "text": "For the period {from} to {to} what was the expenditure on R&D for {ru_name}?", - "placeholders": [ - { - "placeholder": "from", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "identifier": "date-from", - "source": "answers" - }, - { - "source": "metadata", - "identifier": "ref_p_start_date" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "to", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "identifier": "date-to", - "source": "answers" - }, - { - "source": "metadata", - "identifier": "ref_p_end_date" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "ru_name", - "value": { - "source": "metadata", - "identifier": "ru_name" - } - } - ] - }, - "type": "Calculated", - "answers": [ - { - "id": "civil-research", - "mandatory": true, - "type": "Currency", - "label": "Civil Research and Development", - "description": "Enter a value to the nearest thousand (e.g. 56,000).", - "decimal_places": 0, - "currency": "GBP" - }, - { - "id": "defence", - "mandatory": true, - "type": "Currency", - "label": "Defence Research and Development", - "description": "Enter a value to the nearest thousand (e.g. 56,000).", - "decimal_places": 0, - "currency": "GBP" - } - ], - "calculations": [ - { - "calculation_type": "sum", - "answers_to_calculate": ["civil-research", "defence"], - "conditions": ["greater than"], - "value": 0 - } - ] - }, - "page_title": "In-house expenditure on R&D" - }, - { - "id": "calc-summary-1", - "type": "CalculatedSummary", - "page_title": "Total in-house expenditure on R&D", - "title": { - "text": "We have calculated your total in-house expenditure on R&D for {ru_name} for the period {from} to {to} to be %(total)s. Is this correct?", - "placeholders": [ - { - "placeholder": "from", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "identifier": "date-from", - "source": "answers" - }, - { - "source": "metadata", - "identifier": "ref_p_start_date" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "to", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "identifier": "date-to", - "source": "answers" - }, - { - "source": "metadata", - "identifier": "ref_p_end_date" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "ru_name", - "value": { - "source": "metadata", - "identifier": "ru_name" - } - } - ] - }, - "calculation": { - "operation": { - "+": [ - { - "identifier": "civil-research", - "source": "answers" - }, - { - "identifier": "defence", - "source": "answers" - } - ] - }, - "title": "Total in-house expenditure on R&D" - } - }, - { - "id": "how-much-rnd-2", - "type": "Question", - "question": { - "id": "how-much-rnd-question-2", - "title": { - "text": "For the period {from} to {to} what was the expenditure on R&D for {ru_name}?", - "placeholders": [ - { - "placeholder": "from", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "identifier": "date-from", - "source": "answers" - }, - { - "source": "metadata", - "identifier": "ref_p_start_date" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "to", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "identifier": "date-to", - "source": "answers" - }, - { - "source": "metadata", - "identifier": "ref_p_end_date" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "ru_name", - "value": { - "source": "metadata", - "identifier": "ru_name" - } - } - ] - }, - "type": "Calculated", - "answers": [ - { - "id": "innovation", - "mandatory": true, - "type": "Currency", - "label": "Innovation", - "description": "Enter a value to the nearest thousand (e.g. 56,000).", - "decimal_places": 0, - "currency": "GBP" - }, - { - "id": "software", - "mandatory": true, - "type": "Currency", - "label": "Software Development", - "description": "Enter a value to the nearest thousand (e.g. 56,000).", - "decimal_places": 0, - "currency": "GBP" - } - ], - "calculations": [ - { - "calculation_type": "sum", - "answers_to_calculate": ["innovation", "software"], - "conditions": ["greater than"], - "value": 0 - } - ] - }, - "page_title": "In-house expenditure on R&D" - }, - { - "id": "calc-summary-2", - "type": "CalculatedSummary", - "page_title": "Total in-house expenditure on R&D - Part Two", - "title": { - "text": "We have calculated your total in-house expenditure on R&D for {ru_name} for the period {from} to {to} to be %(total)s. Is this correct?", - "placeholders": [ - { - "placeholder": "from", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "identifier": "date-from", - "source": "answers" - }, - { - "source": "metadata", - "identifier": "ref_p_start_date" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "to", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "identifier": "date-to", - "source": "answers" - }, - { - "source": "metadata", - "identifier": "ref_p_end_date" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "ru_name", - "value": { - "source": "metadata", - "identifier": "ru_name" - } - } - ] - }, - "calculation": { - "operation": { - "+": [ - { - "identifier": "innovation", - "source": "answers" - }, - { - "identifier": "software", - "source": "answers" - } - ] - }, - "title": "Total in-house expenditure on R&D - Part Two" - } - }, - { - "type": "GrandCalculatedSummary", - "id": "rnd-grand-calculated-summary", - "title": "We have calculated the grand total of in-house expenditure on R&D to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "calculated_summary", - "identifier": "calc-summary-1" - }, - { - "source": "calculated_summary", - "identifier": "calc-summary-2" - } - ] - }, - "title": "Grand Total in-house expenditure on R&D" - } - } - ] - } - ], - "enabled": { - "when": { - "in": [ - { - "identifier": "undertake-rnd-answer", - "source": "answers" - }, - ["Yes"] - ] - } - } - } - ], - "theme": "business", - "navigation": { - "visible": false - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "ru_ref", - "type": "string" - }, - { - "name": "trad_as", - "type": "string", - "optional": true - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ref_p_start_date", - "type": "date" - }, - { - "name": "ref_p_end_date", - "type": "date" - } - ] -} diff --git a/schemas/test/en/test_placeholder_difference_in_years.json b/schemas/test/en/test_placeholder_difference_in_years.json deleted file mode 100644 index ab633d7326..0000000000 --- a/schemas/test/en/test_placeholder_difference_in_years.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "023", - "title": "Difference between two dates", - "description": "A test schema for calculate age from date", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "dates", - "title": "Date Difference", - "blocks": [ - { - "type": "Question", - "id": "age-block", - "question": { - "id": "date-pipe-question", - "title": "What is your date of birth?", - "type": "General", - "answers": [ - { - "id": "date-dob", - "label": "For example 20 March 1990", - "mandatory": true, - "type": "Date" - } - ] - } - }, - { - "type": "ConfirmationQuestion", - "id": "age-test", - "question": { - "id": "confirm-dob-question", - "title": { - "text": "You are {age} old. Is this correct?", - "placeholders": [ - { - "placeholder": "age", - "transforms": [ - { - "transform": "calculate_date_difference", - "arguments": { - "first_date": { - "source": "answers", - "identifier": "date-dob" - }, - "second_date": { - "value": "now" - } - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "date-test-answer", - "label": "Piped dates", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "age-block", - "when": { - "==": [ - { - "source": "answers", - "identifier": "date-test-answer" - }, - "No" - ] - } - }, - { - "section": "End" - } - ] - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_placeholder_difference_in_years_month_year.json b/schemas/test/en/test_placeholder_difference_in_years_month_year.json deleted file mode 100644 index e25029ffdf..0000000000 --- a/schemas/test/en/test_placeholder_difference_in_years_month_year.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "023", - "title": "Difference between two dates", - "description": "A test schema for calculate age from date", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "dates", - "title": "Date Difference", - "blocks": [ - { - "type": "Question", - "id": "age-block", - "question": { - "id": "date-pipe-question", - "title": "When did you last go on holiday?", - "type": "General", - "answers": [ - { - "id": "date-dob", - "label": "For example March 1990", - "mandatory": true, - "type": "MonthYearDate" - } - ] - } - }, - { - "type": "ConfirmationQuestion", - "id": "age-test", - "question": { - "id": "confirm-dob-question", - "title": { - "text": "It has been {age} since you last went on holiday. Is this correct?", - "placeholders": [ - { - "placeholder": "age", - "transforms": [ - { - "transform": "calculate_date_difference", - "arguments": { - "first_date": { - "source": "answers", - "identifier": "date-dob" - }, - "second_date": { - "value": "now" - } - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "date-test-answer", - "label": "Piped dates", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "age-block", - "when": { - "==": [ - { - "source": "answers", - "identifier": "date-test-answer" - }, - "No" - ] - } - }, - { - "section": "End" - } - ] - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_placeholder_difference_in_years_month_year_range.json b/schemas/test/en/test_placeholder_difference_in_years_month_year_range.json deleted file mode 100644 index 61071e78ee..0000000000 --- a/schemas/test/en/test_placeholder_difference_in_years_month_year_range.json +++ /dev/null @@ -1,134 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "023", - "title": "Difference between two dates", - "description": "A test schema for calculate age from date", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "dates", - "title": "Date Difference", - "blocks": [ - { - "type": "Question", - "id": "date-block", - "question": { - "id": "date-pipe-question", - "title": "How long were you outside the UK?", - "type": "DateRange", - "answers": [ - { - "mandatory": true, - "label": "From", - "id": "period-from", - "type": "MonthYearDate" - }, - { - "mandatory": true, - "label": "To", - "id": "period-to", - "type": "MonthYearDate" - } - ] - } - }, - { - "type": "ConfirmationQuestion", - "id": "age-test", - "question": { - "id": "confirm-dob-question", - "title": { - "text": "You were out of the UK for {time_away}. Is this correct?", - "placeholders": [ - { - "placeholder": "time_away", - "transforms": [ - { - "transform": "calculate_date_difference", - "arguments": { - "first_date": { - "source": "answers", - "identifier": "period-from" - }, - "second_date": { - "source": "answers", - "identifier": "period-to" - } - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "date-test-answer", - "label": "Piped dates", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "date-block", - "when": { - "==": [ - { - "source": "answers", - "identifier": "date-test-answer" - }, - "No" - ] - } - }, - { - "section": "End" - } - ] - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_placeholder_difference_in_years_range.json b/schemas/test/en/test_placeholder_difference_in_years_range.json deleted file mode 100644 index 35f2356af4..0000000000 --- a/schemas/test/en/test_placeholder_difference_in_years_range.json +++ /dev/null @@ -1,134 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "023", - "title": "Difference between two dates", - "description": "A test schema for calculate age from date", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "dates", - "title": "Date Difference", - "blocks": [ - { - "type": "Question", - "id": "date-block", - "question": { - "id": "date-pipe-question", - "title": "How long were you outside the UK?", - "type": "DateRange", - "answers": [ - { - "mandatory": true, - "label": "From", - "id": "period-from", - "type": "Date" - }, - { - "mandatory": true, - "label": "To", - "id": "period-to", - "type": "Date" - } - ] - } - }, - { - "type": "ConfirmationQuestion", - "id": "age-test", - "question": { - "id": "confirm-dob-question", - "title": { - "text": "You were out of the UK for {time_away}. Is this correct?", - "placeholders": [ - { - "placeholder": "time_away", - "transforms": [ - { - "transform": "calculate_date_difference", - "arguments": { - "first_date": { - "source": "answers", - "identifier": "period-from" - }, - "second_date": { - "source": "answers", - "identifier": "period-to" - } - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "date-test-answer", - "label": "Piped dates", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "date-block", - "when": { - "==": [ - { - "source": "answers", - "identifier": "date-test-answer" - }, - "No" - ] - } - }, - { - "section": "End" - } - ] - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_placeholder_first_non_empty_item.json b/schemas/test/en/test_placeholder_first_non_empty_item.json deleted file mode 100644 index a0c6d6e8df..0000000000 --- a/schemas/test/en/test_placeholder_first_non_empty_item.json +++ /dev/null @@ -1,275 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Other input fields", - "theme": "default", - "description": "Questionnaire to check placeholder takes account answers on a path", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "ru_ref", - "type": "string" - }, - { - "name": "trad_as", - "type": "string", - "optional": true - }, - { - "name": "ref_p_start_date", - "type": "date" - }, - { - "name": "ref_p_end_date", - "type": "date" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "default-group", - "blocks": [ - { - "id": "date-question-block", - "type": "Question", - "question": { - "id": "date-question", - "title": { - "text": "Are you able to report for the period from {ref_p_start_date} to {ref_p_end_date}?", - "placeholders": [ - { - "placeholder": "ref_p_start_date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "ref_p_end_date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_end_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "date-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes, I can report for this period", - "value": "Yes, I can report for this period" - }, - { - "label": "No, I need to report for a different period", - "value": "No, I need to report for a different period" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "total-turnover-block", - "when": { - "in": [ - { - "identifier": "date-answer", - "source": "answers" - }, - ["Yes, I can report for this period"] - ] - } - }, - { - "block": "date-entry-block" - } - ] - }, - { - "id": "date-entry-block", - "type": "Question", - "question": { - "id": "date-entry-question", - "title": "What are the dates of the period that you will be reporting for?", - "guidance": { - "contents": [ - { - "description": "Enter a date between 1st of May 2016 and the 31st of May 2016" - } - ] - }, - "type": "DateRange", - "answers": [ - { - "id": "date-entry-answer-from", - "type": "Date", - "mandatory": true, - "label": "From", - "minimum": { - "value": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "offset_by": { - "days": -19 - } - } - }, - { - "id": "date-entry-answer-to", - "type": "Date", - "mandatory": true, - "label": "To", - "maximum": { - "value": { - "source": "metadata", - "identifier": "ref_p_end_date" - }, - "offset_by": { - "days": 20 - } - } - } - ] - } - }, - { - "id": "total-turnover-block", - "type": "Question", - "question": { - "id": "total-turnover-question", - "title": { - "text": "For the period {date_entry_answer_from} to {date_entry_answer_to}, what was {ru_name}'s total turnover, excluding VAT?", - "placeholders": [ - { - "placeholder": "date_entry_answer_from", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "answers", - "identifier": "date-entry-answer-from" - }, - { - "source": "metadata", - "identifier": "ref_p_start_date" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "date_entry_answer_to", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "answers", - "identifier": "date-entry-answer-to" - }, - { - "source": "metadata", - "identifier": "ref_p_end_date" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "ru_name", - "value": { - "source": "metadata", - "identifier": "ru_name" - } - } - ] - }, - "type": "General", - "answers": [ - { - "id": "total-turnover-answer", - "mandatory": true, - "type": "Currency", - "label": "Total turnover excluding VAT", - "description": "Enter the full value (e.g. 56,234.33) or a value to the nearest £thousand (e.g. 56,000). Do not enter '56' for £56,000.", - "decimal_places": 2, - "currency": "GBP" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_placeholder_first_non_empty_item_cross_section_dependencies.json b/schemas/test/en/test_placeholder_first_non_empty_item_cross_section_dependencies.json deleted file mode 100644 index ec3c2f1734..0000000000 --- a/schemas/test/en/test_placeholder_first_non_empty_item_cross_section_dependencies.json +++ /dev/null @@ -1,283 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Other input fields", - "theme": "default", - "description": "Questionnaire to check placeholder takes account answers on a path with cross section dependencies", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "ru_ref", - "type": "string" - }, - { - "name": "trad_as", - "type": "string", - "optional": true - }, - { - "name": "ref_p_start_date", - "type": "date" - }, - { - "name": "ref_p_end_date", - "type": "date" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "default-section", - "title": "Date Selection", - "groups": [ - { - "id": "default-group", - "blocks": [ - { - "id": "date-question-block", - "type": "Question", - "question": { - "id": "date-question", - "title": { - "text": "Are you able to report for the period from {ref_p_start_date} to {ref_p_end_date}?", - "placeholders": [ - { - "placeholder": "ref_p_start_date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "ref_p_end_date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_end_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "date-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes, I can report for this period", - "value": "Yes, I can report for this period" - }, - { - "label": "No, I need to report for a different period", - "value": "No, I need to report for a different period" - } - ] - } - ] - }, - "routing_rules": [ - { - "section": "End", - "when": { - "in": [ - { - "identifier": "date-answer", - "source": "answers" - }, - ["Yes, I can report for this period"] - ] - } - }, - { - "block": "date-entry-block" - } - ] - }, - { - "id": "date-entry-block", - "type": "Question", - "question": { - "id": "date-entry-question", - "title": "What are the dates of the period that you will be reporting for?", - "guidance": { - "contents": [ - { - "description": "Enter a date between 1st of May 2016 and the 31st of May 2016" - } - ] - }, - "type": "DateRange", - "answers": [ - { - "id": "date-entry-answer-from", - "type": "Date", - "mandatory": true, - "label": "From", - "minimum": { - "value": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "offset_by": { - "days": -19 - } - } - }, - { - "id": "date-entry-answer-to", - "type": "Date", - "mandatory": true, - "label": "To", - "maximum": { - "value": { - "source": "metadata", - "identifier": "ref_p_end_date" - }, - "offset_by": { - "days": 20 - } - } - } - ] - } - } - ] - } - ] - }, - { - "id": "second-section", - "title": "Food Expenses", - "groups": [ - { - "id": "second-section-group", - "blocks": [ - { - "id": "food-question-block", - "type": "Question", - "question": { - "id": "food-question", - "title": { - "text": "For the period {date_entry_answer_from} to {date_entry_answer_to}, how much do you spend on food?", - "placeholders": [ - { - "placeholder": "date_entry_answer_from", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "answers", - "identifier": "date-entry-answer-from" - }, - { - "source": "metadata", - "identifier": "ref_p_start_date" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "date_entry_answer_to", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "answers", - "identifier": "date-entry-answer-to" - }, - { - "source": "metadata", - "identifier": "ref_p_end_date" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "ru_name", - "value": { - "source": "metadata", - "identifier": "ru_name" - } - } - ] - }, - "type": "General", - "answers": [ - { - "id": "food-answer", - "mandatory": true, - "type": "Currency", - "label": "Total food expense", - "description": "Enter the full value (e.g. 32.33) or a value to the nearest £thousand (e.g. 56,000). Do not enter '56' for £56,000.", - "decimal_places": 2, - "currency": "GBP" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_placeholder_first_non_empty_item_repeating_sections.json b/schemas/test/en/test_placeholder_first_non_empty_item_repeating_sections.json deleted file mode 100644 index 5feccb91fd..0000000000 --- a/schemas/test/en/test_placeholder_first_non_empty_item_repeating_sections.json +++ /dev/null @@ -1,528 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test first non empty item with repeating sections", - "theme": "default", - "description": "Questionnaire to test first non empty item with repeating sections", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "ref_p_start_date", - "type": "date" - }, - { - "name": "ref_p_end_date", - "type": "date" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "date-section", - "title": "Date Range", - "groups": [ - { - "id": "date-group", - "blocks": [ - { - "id": "date-question-block", - "type": "Question", - "question": { - "id": "date-question", - "title": { - "text": "Are you able to report for the period from {ref_p_start_date} to {ref_p_end_date}?", - "placeholders": [ - { - "placeholder": "ref_p_start_date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "ref_p_end_date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "ref_p_end_date" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "date-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes, I can report for this period", - "value": "Yes, I can report for this period" - }, - { - "label": "No, I need to report for a different period", - "value": "No, I need to report for a different period" - } - ] - } - ] - }, - "routing_rules": [ - { - "section": "End", - "when": { - "in": [ - { - "identifier": "date-answer", - "source": "answers" - }, - ["Yes, I can report for this period"] - ] - } - }, - { - "block": "date-entry-block" - } - ] - }, - { - "id": "date-entry-block", - "type": "Question", - "question": { - "id": "date-entry-question", - "title": "What are the dates of the period that you will be reporting for?", - "guidance": { - "contents": [ - { - "description": "Enter a date between 1st of May 2016 and the 31st of May 2016" - } - ] - }, - "type": "DateRange", - "answers": [ - { - "id": "date-entry-answer-from", - "type": "Date", - "mandatory": true, - "label": "From", - "minimum": { - "value": { - "source": "metadata", - "identifier": "ref_p_start_date" - }, - "offset_by": { - "days": -19 - } - } - }, - { - "id": "date-entry-answer-to", - "type": "Date", - "mandatory": true, - "label": "To", - "maximum": { - "value": { - "source": "metadata", - "identifier": "ref_p_end_date" - }, - "offset_by": { - "days": 20 - } - } - } - ] - } - } - ] - } - ] - }, - { - "id": "list-collector-section", - "title": "List Collector Section", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": "Household members", - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "title": { - "text": "Between {date_entry_answer_from} to {date_entry_answer_to} did anyone else live here?", - "placeholders": [ - { - "placeholder": "date_entry_answer_from", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "answers", - "identifier": "date-entry-answer-from" - }, - { - "source": "metadata", - "identifier": "ref_p_start_date" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "date_entry_answer_to", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "answers", - "identifier": "date-entry-answer-to" - }, - { - "source": "metadata", - "identifier": "ref_p_end_date" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "cancel_text": "Don’t need to add anyone else?", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "cancel_text": "Don’t need to change anything?", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "cancel_text": "Don’t need to remove this person?", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "warning": "All of the information about this person will be deleted", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "repeating-section", - "title": "Personal Details", - "summary": { "show_on_completion": true }, - "repeat": { - "for_list": "people", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "groups": [ - { - "id": "personal-details-group", - "title": "Personal Details", - "blocks": [ - { - "type": "Question", - "id": "personal-details-block", - "question": { - "type": "General", - "id": "personal-details-question", - "title": { - "text": "Between {date_entry_answer_from} to {date_entry_answer_to} what did you drink the most?", - "placeholders": [ - { - "placeholder": "date_entry_answer_from", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "answers", - "identifier": "date-entry-answer-from" - }, - { - "source": "metadata", - "identifier": "ref_p_start_date" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - }, - { - "placeholder": "date_entry_answer_to", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "answers", - "identifier": "date-entry-answer-to" - }, - { - "source": "metadata", - "identifier": "ref_p_end_date" - } - ] - } - }, - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "previous_transform" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "answers": [ - { - "id": "personal-details-answer", - "mandatory": true, - "options": [ - { - "label": "Coffee", - "value": "Coffee" - }, - { - "label": "Tea", - "value": "Tea" - } - ], - "type": "Checkbox" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_placeholder_full.json b/schemas/test/en/test_placeholder_full.json deleted file mode 100644 index 8218e923af..0000000000 --- a/schemas/test/en/test_placeholder_full.json +++ /dev/null @@ -1,341 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Placeholder Test", - "theme": "default", - "description": "A questionnaire to test placeholders", - "navigation": { - "visible": true - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "display_address", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "name-section", - "title": "Name Input", - "groups": [ - { - "id": "name-group", - "blocks": [ - { - "type": "Question", - "id": "name-question", - "question": { - "id": "primary-name-question", - "title": "Please enter a name", - "type": "General", - "answers": [ - { - "id": "first-name", - "label": "First Name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last Name", - "mandatory": false, - "type": "TextField" - } - ] - } - } - ] - } - ] - }, - { - "id": "age-input-section", - "title": "Age Input", - "groups": [ - { - "id": "dob-input-group", - "blocks": [ - { - "type": "Question", - "id": "dob-question-block", - "question": { - "id": "dob-question", - "title": { - "text": "What is {person_name_possessive} date of birth?", - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "date-of-birth-answer", - "description": "Enter your date of birth", - "label": "Date of Birth", - "mandatory": true, - "type": "Date" - } - ] - } - } - ] - } - ] - }, - { - "id": "age-confirmation-section", - "title": "Age Confirmation", - "groups": [ - { - "blocks": [ - { - "type": "ConfirmationQuestion", - "id": "confirm-dob-proxy", - "question": { - "id": "confirm-date-of-birth-proxy", - "title": { - "text": "{person_name} is {age} old. Is this correct?", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "age", - "transforms": [ - { - "transform": "calculate_date_difference", - "arguments": { - "first_date": { - "source": "answers", - "identifier": "date-of-birth-answer" - }, - "second_date": { - "value": "now" - } - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "confirm-date-of-birth-answer-proxy", - "mandatory": true, - "options": [ - { - "label": { - "text": "Yes, {person_name} is {age} old.", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "age", - "transforms": [ - { - "transform": "calculate_date_difference", - "arguments": { - "first_date": { - "source": "answers", - "identifier": "date-of-birth-answer" - }, - "second_date": { - "value": "now" - } - } - } - ] - } - ] - }, - "value": "Yes, {person_name} is {age} old." - }, - { - "label": "No, I need to change their date of birth", - "value": "No, I need to change their date of birth" - } - ], - "type": "Radio" - } - ] - }, - "routing_rules": [ - { - "group": "dob-input-group", - "when": { - "==": [ - { - "source": "answers", - "identifier": "confirm-date-of-birth-answer-proxy" - }, - "No, I need to change their date of birth" - ] - } - }, - { - "section": "End" - } - ] - } - ], - "id": "group" - } - ] - }, - { - "id": "mutually-exclusive-checkbox-section", - "title": "Checkbox", - "groups": [ - { - "id": "mutually-exclusive-mandatory-group", - "blocks": [ - { - "type": "Question", - "id": "mutually-exclusive-checkbox", - "question": { - "id": "mutually-exclusive-checkbox-question", - "type": "MutuallyExclusive", - "title": "Were you a resident at any of the following addresses?", - "mandatory": true, - "answers": [ - { - "id": "checkbox-answer", - "instruction": "Select an answer", - "type": "Checkbox", - "mandatory": false, - "options": [ - { - "label": { - "placeholders": [ - { - "placeholder": "household_address", - "value": { - "identifier": "display_address", - "source": "metadata" - } - } - ], - "text": "{household_address}" - }, - "value": "{household_address}" - }, - { - "label": "7 Evelyn Street, Barry", - "value": "7 Evelyn Street, Barry" - }, - { - "label": "251 Argae Lane, Barry", - "value": "251 Argae Lane, Barry" - } - ] - }, - { - "id": "checkbox-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "description": "Some description", - "value": "I prefer not to say" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_placeholder_metadata.json b/schemas/test/en/test_placeholder_metadata.json deleted file mode 100644 index c34f90eede..0000000000 --- a/schemas/test/en/test_placeholder_metadata.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test placeholder metadata", - "theme": "default", - "description": "A questionnaire to demo placeholder metadata", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "mandatory-radio", - "question": { - "type": "General", - "id": "mandatory-radio-question", - "title": "Who is the respondent of your business ?", - "answers": [ - { - "type": "Radio", - "id": "mandatory-radio-answer", - "mandatory": true, - "options": [ - { - "label": { - "text": "{ru_name}", - "placeholders": [ - { - "placeholder": "ru_name", - "value": { - "source": "metadata", - "identifier": "ru_name" - } - } - ] - }, - "value": "{ru_name}" - }, - { - "label": "Google LTD", - "value": "Google LTD" - }, - { - "label": "Meta LTD", - "value": "Meta LTD" - } - ] - } - ] - } - } - ], - "id": "checkboxes" - } - ] - } - ] -} diff --git a/schemas/test/en/test_placeholder_option_label_from_value.json b/schemas/test/en/test_placeholder_option_label_from_value.json deleted file mode 100644 index 79102c41e6..0000000000 --- a/schemas/test/en/test_placeholder_option_label_from_value.json +++ /dev/null @@ -1,151 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test option label from value", - "theme": "default", - "description": "A questionnaire to demo the piping of Checkbox/Radio answer options", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "trad_as", - "type": "string", - "optional": true - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "checkbox-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "mandatory-radio", - "question": { - "type": "General", - "id": "mandatory-radio-question", - "title": "What is the trade name of your business ?", - "guidance": { - "contents": [ - { - "description": "First option is piped from metadata" - } - ] - }, - "answers": [ - { - "type": "Radio", - "id": "mandatory-radio-answer", - "mandatory": true, - "options": [ - { - "label": { - "text": "{business_name} (piped)", - "placeholders": [ - { - "placeholder": "business_name", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "metadata", - "identifier": "trad_as" - } - ] - } - } - ] - } - ] - }, - "value": "{business_name} (piped)" - }, - { - "label": "Google LTD", - "value": "Google LTD" - }, - { - "label": "Meta LTD", - "value": "Meta LTD" - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "confirmation-question-radio-block", - "question": { - "id": "confirmation-question-radio", - "title": { - "text": "You chose {business_name} as your business name, is that correct ?", - "placeholders": [ - { - "placeholder": "business_name", - "transforms": [ - { - "transform": "option_label_from_value", - "arguments": { - "value": { - "source": "answers", - "identifier": "mandatory-radio-answer" - }, - "answer_id": "mandatory-radio-answer" - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "type": "Radio", - "id": "confirm-business-radio-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - } - ], - "id": "checkboxes" - } - ] - } - ] -} diff --git a/schemas/test/en/test_placeholder_playback_list.json b/schemas/test/en/test_placeholder_playback_list.json deleted file mode 100644 index 6844986e74..0000000000 --- a/schemas/test/en/test_placeholder_playback_list.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Other input fields", - "theme": "default", - "description": "A questionnaire to demo checkbox field Other input.", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "mandatory-checkbox", - "question": { - "answers": [ - { - "id": "mandatory-checkbox-answer", - "mandatory": true, - "options": [ - { - "label": "None", - "value": "None" - }, - { - "label": "Cheese", - "value": "Cheese" - }, - { - "label": "Ham", - "value": "Ham" - }, - { - "label": "Pineapple", - "value": "Pineapple" - }, - { - "label": "Tuna", - "value": "Tuna" - }, - { - "label": "Pepperoni", - "value": "Pepperoni" - }, - { - "label": "Other", - "description": "Choose any other topping", - "value": "Other", - "detail_answer": { - "mandatory": true, - "id": "other-answer-mandatory", - "label": "Please specify other", - "type": "TextField" - } - } - ], - "type": "Checkbox", - "validation": { - "messages": {} - } - } - ], - "id": "mandatory-checkbox-question", - "title": "Which pizza toppings would you like?", - "type": "General" - } - }, - { - "type": "ConfirmationQuestion", - "id": "confirm-answers-block", - "question": { - "type": "General", - "answers": [ - { - "type": "Radio", - "id": "confirm-answers", - "options": [ - { - "label": "Yes this is correct", - "value": "Yes this is correct" - }, - { - "label": "No I need to change this", - "value": "No I need to change this" - } - ], - "mandatory": true - } - ], - "id": "confirm-answers-question", - "title": "You selected the following toppings. Is this correct?", - "description": [ - { - "text": "{toppings}", - "placeholders": [ - { - "placeholder": "toppings", - "transforms": [ - { - "transform": "format_list", - "arguments": { - "list_to_format": { - "source": "answers", - "identifier": "mandatory-checkbox-answer" - } - } - } - ] - } - ] - } - ] - }, - "routing_rules": [ - { - "when": { - "==": [ - { - "source": "answers", - "identifier": "confirm-answers" - }, - "No I need to change this" - ] - }, - "block": "mandatory-checkbox" - }, - { - "section": "End" - } - ] - } - ], - "id": "checkboxes" - } - ] - } - ] -} diff --git a/schemas/test/en/test_placeholder_transform.json b/schemas/test/en/test_placeholder_transform.json deleted file mode 100644 index 78f2bfb63e..0000000000 --- a/schemas/test/en/test_placeholder_transform.json +++ /dev/null @@ -1,336 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Placeholder Test", - "theme": "default", - "description": "A questionnaire to test placeholders", - "navigation": { - "visible": true - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "trad_as", - "type": "string", - "optional": true - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "retail-turnover-section", - "title": "Retail Turnover Input", - "groups": [ - { - "id": "retail-turnover-group", - "blocks": [ - { - "type": "Question", - "id": "total-retail-turnover-block", - "question": { - "id": "total-retail-turnover-question", - "title": { - "text": "For {ru_name}{conditional_trad_as}, please enter the total retail turnover", - "placeholders": [ - { - "placeholder": "conditional_trad_as", - "transforms": [ - { - "arguments": { - "trad_as": { - "source": "metadata", - "identifier": "trad_as" - } - }, - "transform": "conditional_trad_as" - } - ] - }, - { - "placeholder": "ru_name", - "value": { - "source": "metadata", - "identifier": "ru_name" - } - } - ] - }, - "type": "General", - "answers": [ - { - "id": "total-retail-turnover-answer", - "label": "Total Retail Turnover", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - } - ] - } - ] - }, - { - "id": "percent-input-section", - "title": "Reporting Confirmation", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "report-period", - "question": { - "type": "General", - "id": "total-retail-turnover-confirmation-question", - "title": "Please enter the value of internet sales", - "description": [ - { - "text": "Of the {total_turnover} total retail turnover, what was the value of internet sales?", - "placeholders": [ - { - "placeholder": "total_turnover", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "source": "answers", - "identifier": "total-retail-turnover-answer" - } - } - } - ] - } - ] - } - ], - "answers": [ - { - "id": "total-retail-turnover-internet-sales-answer", - "label": "Value of Internet Sales", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - } - ], - "id": "retail-confirmation-group" - } - ] - }, - { - "id": "total-items", - "title": "Total Amount of Items", - "groups": [ - { - "id": "total-items-group", - "blocks": [ - { - "type": "Question", - "id": "total-items-block", - "question": { - "id": "total-items-question", - "title": "Please enter the number of items", - "type": "General", - "answers": [ - { - "id": "total-items-answer", - "label": "Number of Items", - "mandatory": false, - "type": "Number", - "default": 0 - } - ] - } - }, - { - "id": "add-item", - "question": { - "answers": [ - { - "id": "add-item-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "add-item-question", - "title": { - "placeholders": [ - { - "placeholder": "item", - "transforms": [ - { - "transform": "add", - "arguments": { - "lhs": { - "source": "answers", - "identifier": "total-items-answer" - }, - "rhs": { - "value": 1 - } - } - }, - { - "arguments": { - "number_to_format": { - "source": "previous_transform" - }, - "determiner": { - "value": "a_or_an" - } - }, - "transform": "format_ordinal" - } - ] - } - ], - "text": "Do you want to add {item} item?" - }, - "type": "General" - }, - "type": "Question" - }, - { - "type": "Question", - "id": "training-percentage-block", - "question": { - "answers": [ - { - "id": "training-percentage", - "mandatory": false, - "decimal_places": 0, - "type": "Percentage", - "label": "Percentage of company budget", - "default": 0 - } - ], - "id": "training-percentage-question", - "title": "What percentage of the company budget you spend on training ?", - "type": "General" - } - }, - { - "id": "training-percentage-interstitial", - "content": { - "title": "Percentage of budget spent on training interstitial", - "contents": [ - { - "description": { - "text": "The percentage of the company budget you spend on training is {answer_percentage}", - "placeholders": [ - { - "placeholder": "answer_percentage", - "transforms": [ - { - "transform": "format_percentage", - "arguments": { - "value": { - "source": "answers", - "identifier": "training-percentage" - } - } - } - ] - } - ] - } - } - ] - }, - "type": "Interstitial" - }, - { - "type": "Question", - "id": "average-distance-block", - "question": { - "answers": [ - { - "id": "average-distance", - "mandatory": false, - "unit": "length-mile", - "type": "Unit", - "unit_length": "long", - "label": "Average commuting distance", - "default": 0 - } - ], - "id": "average-distance-question", - "title": "What is the average commuting distance of an employee (in miles) ?", - "type": "General" - } - }, - { - "id": "average-distance-interstitial", - "content": { - "title": "Average commuting distance interstitial", - "contents": [ - { - "description": { - "text": "The average commuting distance of an employee is {answer_distance}", - "placeholders": [ - { - "placeholder": "answer_distance", - "transforms": [ - { - "transform": "format_unit", - "arguments": { - "value": { - "source": "answers", - "identifier": "average-distance" - }, - "unit": "length-mile", - "unit_length": "long" - } - } - ] - } - ] - } - } - ] - }, - "type": "Interstitial" - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_placeholder_transform_date_range_bounds.json b/schemas/test/en/test_placeholder_transform_date_range_bounds.json deleted file mode 100644 index f6092b1a37..0000000000 --- a/schemas/test/en/test_placeholder_transform_date_range_bounds.json +++ /dev/null @@ -1,174 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Other input fields", - "theme": "default", - "description": "A questionnaire to test date_range_bounds and format_date_range", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "days-worked-section", - "title": "Days Input", - "groups": [ - { - "id": "days-input-group", - "blocks": [ - { - "type": "Question", - "id": "date-question", - "question": { - "id": "primary-date-question", - "title": "Please enter a reference date to generate a date range", - "type": "General", - "answers": [ - { - "id": "reference-date", - "label": "Reference Date", - "description": "This scenario uses 1 prior full week offset, 15 day range, first day of the week monday", - "mandatory": true, - "type": "Date" - } - ] - } - }, - { - "type": "Question", - "id": "days-question-block", - "question": { - "id": "days-question", - "title": { - "text": "How many days did you work between {formatted_date_range}?", - "placeholders": [ - { - "placeholder": "formatted_date_range", - "transforms": [ - { - "transform": "date_range_bounds", - "arguments": { - "reference_date": { - "source": "answers", - "identifier": "reference-date" - }, - "offset_full_weeks": -1, - "days_in_range": 15, - "first_day_of_week": "MONDAY" - } - }, - { - "arguments": { - "date_range": { - "source": "previous_transform" - } - }, - "transform": "format_date_range" - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "days-worked-answer", - "label": "Days worked", - "description": "This scenario uses 1 prior full week offset, 15 day range, first day of the week monday", - "mandatory": false, - "type": "Number" - } - ] - } - }, - { - "id": "block0", - "type": "Question", - "question": { - "id": "question0", - "title": "Title", - "type": "General", - "answers": [ - { - "id": "ref-answer0", - "mandatory": true, - "type": "Date", - "label": "Start of a date range" - }, - { - "id": "ref-answer1", - "mandatory": true, - "type": "Date", - "label": "End of a date range" - } - ] - } - }, - { - "type": "Question", - "id": "range-question-block", - "question": { - "id": "range-question", - "title": { - "text": "This is a formatted date range: {formatted_date_range}", - "placeholders": [ - { - "placeholder": "formatted_date_range", - "transforms": [ - { - "transform": "format_date_range", - "arguments": { - "date_range": [ - { - "source": "answers", - "identifier": "ref-answer0" - }, - { - "source": "answers", - "identifier": "ref-answer1" - } - ] - } - } - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "date-range-answer", - "label": "How many days did you work during this period?", - "mandatory": false, - "type": "Number" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_plural_forms.json b/schemas/test/en/test_plural_forms.json deleted file mode 100644 index ab0833d74c..0000000000 --- a/schemas/test/en/test_plural_forms.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Plural Forms", - "theme": "default", - "description": "A questionnaire to test different forms of plurals", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "plural-section", - "title": "Test Plural Section", - "groups": [ - { - "id": "plural-group", - "title": "Test Plurals", - "blocks": [ - { - "type": "Question", - "id": "number-of-people-block", - "question": { - "answers": [ - { - "id": "number-of-people-answer", - "label": "How many people live here?", - "mandatory": true, - "type": "Number", - "minimum": { - "value": 0 - }, - "maximum": { - "value": 100 - } - } - ], - "id": "number-of-people-question", - "title": "Title", - "type": "General" - } - }, - { - "type": "Question", - "id": "confirm-number-of-people", - "question": { - "type": "General", - "id": "total-people-question", - "title": { - "text_plural": { - "forms": { - "one": "{number_of_people} person lives here, is this correct?", - "other": "{number_of_people} people live here, is this correct?" - }, - "count": { - "source": "answers", - "identifier": "number-of-people-answer" - } - }, - "placeholders": [ - { - "placeholder": "number_of_people", - "value": { - "source": "answers", - "identifier": "number-of-people-answer" - } - } - ] - }, - "answers": [ - { - "id": "confirm-count", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": { - "text_plural": { - "forms": { - "one": "Yes, {number_of_people} person lives here", - "other": "Yes, {number_of_people} people live here" - }, - "count": { - "source": "answers", - "identifier": "number-of-people-answer" - } - }, - "placeholders": [ - { - "placeholder": "number_of_people", - "value": { - "source": "answers", - "identifier": "number-of-people-answer" - } - } - ] - }, - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_progress_block_value_source_repeating_sections.json b/schemas/test/en/test_progress_block_value_source_repeating_sections.json deleted file mode 100644 index 764e05b6ea..0000000000 --- a/schemas/test/en/test_progress_block_value_source_repeating_sections.json +++ /dev/null @@ -1,392 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "survey_id": "139", - "theme": "default", - "title": "Progress Value Source Repeating Sections Test", - "data_version": "0.0.3", - "description": "Progress Value Source Repeating Sections Test", - "navigation": { - "visible": true - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "trad_as", - "type": "string", - "optional": true - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section-1", - "title": "List collector + random question", - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "type": "Question", - "id": "question-block", - "question": { - "id": "question", - "title": "Question", - "description": ["The next question is used as a dependency in the repeating sections."], - "type": "General", - "answers": [ - { - "id": "answer", - "mandatory": false, - "label": "Enter any number", - "type": "Number" - } - ] - } - }, - { - "type": "Question", - "id": "random-question-enabler-block", - "question": { - "id": "random-question-enabler-question", - "title": "Random question enabler", - "description": [ - "Answering this question will enable the random question in the repeated section coming after the list collector." - ], - "type": "General", - "answers": [ - { - "id": "random-question-enabler-answer", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ] - } - ] - }, - { - "id": "section-2", - "title": "Questions", - "summary": { "show_on_completion": true }, - "repeat": { - "for_list": "people", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "groups": [ - { - "id": "dob-group", - "title": "Date of birth", - "blocks": [ - { - "type": "Question", - "id": "dob-block", - "question": { - "answers": [ - { - "id": "date-of-birth-answer", - "mandatory": false, - "maximum": { - "value": "now" - }, - "minimum": { - "offset_by": { - "years": -115 - }, - "value": "2019-10-13" - }, - "type": "Date" - } - ], - "guidance": { - "contents": [ - { - "description": "For example 31 12 1970" - } - ] - }, - "id": "date-of-birth-question", - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "What is {person_name_possessive} date of birth?" - }, - "type": "General" - } - }, - { - "type": "Question", - "id": "other-question-block", - "question": { - "id": "other-question", - "answers": [ - { - "id": "other-answer", - "mandatory": true, - "label": "Anything", - "type": "Number" - } - ], - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "Random question about {person_name_possessive}" - }, - "description": ["Shows because the random question was completed in section 1"], - "type": "General" - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "block", - "identifier": "random-question-enabler-block" - }, - "COMPLETED" - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_progress_section_value_source_repeating_sections.json b/schemas/test/en/test_progress_section_value_source_repeating_sections.json deleted file mode 100644 index dcdfad3364..0000000000 --- a/schemas/test/en/test_progress_section_value_source_repeating_sections.json +++ /dev/null @@ -1,392 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "survey_id": "139", - "theme": "default", - "title": "Progress Value Source Repeating Sections Test", - "data_version": "0.0.3", - "description": "Progress Value Source Repeating Sections Test", - "navigation": { - "visible": true - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "trad_as", - "type": "string", - "optional": true - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section-1", - "title": "List collector + random question", - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "type": "Question", - "id": "question-block", - "question": { - "id": "question", - "title": "Question", - "description": ["The next question is used as a dependency in the repeating sections."], - "type": "General", - "answers": [ - { - "id": "answer", - "mandatory": false, - "label": "Enter any number", - "type": "Number" - } - ] - } - }, - { - "type": "Question", - "id": "random-question-enabler-block", - "question": { - "id": "random-question-enabler-question", - "title": "Random question enabler", - "description": [ - "Answering this question will enable the random question in the repeated section coming after the list collector." - ], - "type": "General", - "answers": [ - { - "id": "random-question-enabler-answer", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ] - } - ] - }, - { - "id": "section-2", - "title": "Questions", - "summary": { "show_on_completion": true }, - "repeat": { - "for_list": "people", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "groups": [ - { - "id": "dob-group", - "title": "Date of birth", - "blocks": [ - { - "type": "Question", - "id": "dob-block", - "question": { - "answers": [ - { - "id": "date-of-birth-answer", - "mandatory": false, - "maximum": { - "value": "now" - }, - "minimum": { - "offset_by": { - "years": -115 - }, - "value": "2019-10-13" - }, - "type": "Date" - } - ], - "guidance": { - "contents": [ - { - "description": "For example 31 12 1970" - } - ] - }, - "id": "date-of-birth-question", - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "What is {person_name_possessive} date of birth?" - }, - "type": "General" - } - }, - { - "type": "Question", - "id": "other-question-block", - "question": { - "id": "other-question", - "answers": [ - { - "id": "other-answer", - "mandatory": true, - "label": "Anything", - "type": "Number" - } - ], - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "Random question about {person_name_possessive}" - }, - "description": ["Shows because the random question was completed in section 1"], - "type": "General" - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-1" - }, - "COMPLETED" - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_progress_value_source_blocks.json b/schemas/test/en/test_progress_value_source_blocks.json deleted file mode 100644 index 3a10d2a382..0000000000 --- a/schemas/test/en/test_progress_value_source_blocks.json +++ /dev/null @@ -1,210 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test progress value source", - "theme": "default", - "description": "A test survey for testing progres value source referencing blocks", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section-1", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "s1-b1", - "question": { - "id": "s1-b1-q1", - "title": "Section 1 Question 1", - "description": [ - "If you answer 0, then the second question will be skipped because of a routing rule, as well as the fourth question because of a skip condition referencing the progress of question 2, as well as the 6th question because of a routing rule referencing the progress of question 4.", - "So only questions 3, 5, 7 will be displayed.", - "Otherwise, questions 2, 4 and 6 can also display." - ], - "type": "General", - "answers": [ - { - "id": "s1-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "routing_rules": [ - { - "when": { - "==": [ - { - "source": "answers", - "identifier": "s1-b1-q1-a1" - }, - 0 - ] - }, - "block": "s1-b3" - }, - { - "block": "s1-b2" - } - ] - }, - { - "type": "Question", - "id": "s1-b2", - "question": { - "id": "s1-b2-q1", - "title": "Section 1 Question 2", - "description": ["Showing this question because question 1 value is not 0"], - "type": "General", - "answers": [ - { - "id": "s1-b2-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - }, - { - "type": "Question", - "id": "s1-b3", - "question": { - "id": "s1-b3-q1", - "title": "Section 1 Question 3", - "type": "General", - "answers": [ - { - "id": "s1-b3-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - }, - { - "type": "Question", - "id": "s1-b4", - "question": { - "id": "s1-b4-q1", - "title": "Section 1 Question 4", - "type": "General", - "answers": [ - { - "id": "s1-b4-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [{ "source": "progress", "selector": "block", "identifier": "s1-b2" }, "COMPLETED"] - } - } - }, - { - "type": "Question", - "id": "s1-b5", - "question": { - "id": "s1-b5-q1", - "title": "Section 1 Question 5", - "type": "General", - "answers": [ - { - "id": "s1-b5-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "routing_rules": [ - { - "when": { - "==": [ - { - "source": "progress", - "selector": "block", - "identifier": "s1-b4" - }, - "COMPLETED" - ] - }, - "block": "s1-b6" - }, - { - "block": "s1-b7" - } - ] - }, - { - "type": "Question", - "id": "s1-b6", - "question": { - "id": "s1-b6-q1", - "title": "Section 1 Question 6", - "description": ["Showing this question because question 4 was completed"], - "type": "General", - "answers": [ - { - "id": "s1-b6-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - }, - { - "type": "Question", - "id": "s1-b7", - "question": { - "id": "s1-b7-q1", - "title": "Section 1 Question 7", - "type": "General", - "answers": [ - { - "id": "s1-b7-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ], - "id": "group-1" - } - ] - } - ] -} diff --git a/schemas/test/en/test_progress_value_source_blocks_cross_section.json b/schemas/test/en/test_progress_value_source_blocks_cross_section.json deleted file mode 100644 index d8cb40da44..0000000000 --- a/schemas/test/en/test_progress_value_source_blocks_cross_section.json +++ /dev/null @@ -1,224 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test progress value source", - "theme": "default", - "description": "A test survey for testing progres value source referencing blocks", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section-1", - "title": "Section One", - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "s1-b1", - "question": { - "id": "s1-b1-q1", - "title": "Section 1 Question 1", - "description": [ - "If you answer 0, then the second question will be skipped because of a routing rule, as well as the fourth question because of a skip condition referencing the progress of question 2, as well as the 6th question in the Second Section because of a routing rule referencing the progress of question 4.", - "So only question 3 in Section One, and questions 5 and 7 in Section Two will be displayed.", - "Otherwise, questions 2 and 4 in Section Ona and question 6 in Section Two can also display." - ], - "type": "General", - "answers": [ - { - "id": "s1-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "routing_rules": [ - { - "when": { - "==": [ - { - "source": "answers", - "identifier": "s1-b1-q1-a1" - }, - 0 - ] - }, - "block": "s1-b3" - }, - { - "block": "s1-b2" - } - ] - }, - { - "type": "Question", - "id": "s1-b2", - "question": { - "id": "s1-b2-q1", - "title": "Section 1 Question 2", - "description": ["Showing this question because question 1 value is not 0"], - "type": "General", - "answers": [ - { - "id": "s1-b2-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - }, - { - "type": "Question", - "id": "s1-b3", - "question": { - "id": "s1-b3-q1", - "title": "Section 1 Question 3", - "type": "General", - "answers": [ - { - "id": "s1-b3-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - }, - { - "type": "Question", - "id": "s1-b4", - "question": { - "id": "s1-b4-q1", - "title": "Section 1 Question 4", - "type": "General", - "answers": [ - { - "id": "s1-b4-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [{ "source": "progress", "selector": "block", "identifier": "s1-b2" }, "COMPLETED"] - } - } - } - ], - "id": "group-1" - } - ] - }, - { - "id": "section-2", - "title": "Section Two", - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "s2-b5", - "question": { - "id": "s2-b5-q1", - "title": "Section 2 Question 5", - "type": "General", - "answers": [ - { - "id": "s2-b5-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "routing_rules": [ - { - "when": { - "==": [ - { - "source": "progress", - "selector": "block", - "identifier": "s1-b4" - }, - "COMPLETED" - ] - }, - "block": "s2-b6" - }, - { - "block": "s2-b7" - } - ] - }, - { - "type": "Question", - "id": "s2-b6", - "question": { - "id": "s2-b6-q1", - "title": "Section 2 Question 6", - "description": ["Showing this question because question 4 in Section One was completed"], - "type": "General", - "answers": [ - { - "id": "s2-b6-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - }, - { - "type": "Question", - "id": "s2-b7", - "question": { - "id": "s2-b7-q1", - "title": "Section 2 Question 7", - "type": "General", - "answers": [ - { - "id": "s2-b7-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ], - "id": "group-2" - } - ] - } - ] -} diff --git a/schemas/test/en/test_progress_value_source_calculated_summary.json b/schemas/test/en/test_progress_value_source_calculated_summary.json deleted file mode 100644 index be36064f2b..0000000000 --- a/schemas/test/en/test_progress_value_source_calculated_summary.json +++ /dev/null @@ -1,517 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "survey_id": "139", - "theme": "default", - "title": "Progress Value Source Repeating Sections Test", - "data_version": "0.0.3", - "description": "Progress Value Source Repeating Sections Test", - "navigation": { - "visible": true - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "trad_as", - "type": "string", - "optional": true - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section-1", - "title": "Calculated Summary", - "summary": { "show_on_completion": true }, - "groups": [ - { - "id": "group-1", - "title": "Calculated Summary group", - "blocks": [ - { - "type": "Question", - "id": "first-number-block", - "question": { - "id": "first-number-question", - "title": "First Number Question Title", - "type": "General", - "answers": [ - { - "id": "first-number-answer", - "label": "First answer label", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "second-number-block", - "question": { - "id": "second-number-question", - "title": "Second Number Question Title", - "type": "General", - "answers": [ - { - "id": "second-number-answer", - "label": "Second answer label", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-block", - "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "first-number-answer" - }, - { - "source": "answers", - "identifier": "second-number-answer" - } - ] - }, - "title": "Grand total of previous values" - } - } - ] - } - ] - }, - { - "id": "section-2", - "title": "Skippable random question + List collector", - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "type": "Question", - "id": "s2-b1", - "question": { - "id": "s2-b1-q1", - "title": "Skippable random question", - "type": "General", - "answers": [ - { - "id": "s2-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "block", - "identifier": "calculated-summary-block" - }, - "COMPLETED" - ] - } - } - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "section-3", - "title": "Repeating section", - "summary": { "show_on_completion": true }, - "repeat": { - "for_list": "people", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "groups": [ - { - "id": "dob-group", - "title": "Date of birth", - "blocks": [ - { - "type": "Question", - "id": "dob-block", - "question": { - "answers": [ - { - "id": "date-of-birth-answer", - "mandatory": false, - "maximum": { - "value": "now" - }, - "minimum": { - "offset_by": { - "years": -115 - }, - "value": "2019-10-13" - }, - "type": "Date" - } - ], - "guidance": { - "contents": [ - { - "description": "For example 31 12 1970" - } - ] - }, - "id": "date-of-birth-question", - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "What is {person_name_possessive} date of birth?" - }, - "type": "General" - } - }, - { - "type": "Question", - "id": "other-question-block", - "question": { - "id": "other-question", - "answers": [ - { - "id": "other-answer", - "mandatory": true, - "label": "Anything", - "type": "Number" - } - ], - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "Random question about {person_name_possessive}" - }, - "description": ["Shows because the calculated summary was completed in section 1"], - "type": "General" - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "block", - "identifier": "calculated-summary-block" - }, - "COMPLETED" - ] - } - } - }, - { - "type": "Question", - "id": "other-question-block-2", - "question": { - "id": "other-question-2", - "answers": [ - { - "id": "other-answer-2", - "mandatory": true, - "label": "Anything", - "type": "Number" - } - ], - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "Another random question about {person_name_possessive}" - }, - "description": ["Shows because block 2 of this repeating section was completed."], - "type": "General" - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "block", - "identifier": "other-question-block" - }, - "COMPLETED" - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_progress_value_source_calculated_summary_extended.json b/schemas/test/en/test_progress_value_source_calculated_summary_extended.json deleted file mode 100644 index caac2ba203..0000000000 --- a/schemas/test/en/test_progress_value_source_calculated_summary_extended.json +++ /dev/null @@ -1,1129 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "survey_id": "139", - "theme": "default", - "title": "Progress Value Source Caluclated Summary (Extended)", - "data_version": "0.0.3", - "description": "An extended version of the Progress Value Source Calculated Summary schema intended to test chained dependency evaluation for progress value sources where multiple sections have progress value source dependencies on one another", - "navigation": { - "visible": true - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "trad_as", - "type": "string", - "optional": true - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { - "required_completed_sections": ["introduction-section"] - } - }, - "sections": [ - { - "id": "introduction-section", - "title": "Guidance", - "show_on_hub": false, - "groups": [ - { - "blocks": [ - { - "id": "interstitial", - "content": { - "title": "Guidance for completing this test schema", - "contents": [ - { - "description": "This schema was created in order to ensure that dependencies based on a progress value sources captured in order." - }, - { - "description": "It is also being used to test progress value sources with chained dependents. For example, In this schema, Sections 7, 8, 9 and 10 are all dependent on Section 2, and Sections 11 and 12 are dependent on Section 9 and 10." - }, - { - "description": "So we can use this schema to test journeys and ensure that all dependent sections are updated. For example if we had not started Section 2 yet, but Sections 8, 9 and 10 are all Complete, and sections 11 and 12 are Partially Completed. Given the dependencies in this schema, completing Section 2 would mean that the status of Sections 8, 9 and 10 would change to Partially Complete and Sections 11 and 12 to Complete." - } - ] - }, - "type": "Interstitial" - } - ], - "id": "introduction-group", - "title": "Test Schema Guidance" - } - ] - }, - { - "id": "section-1", - "title": "Calculated Summary", - "groups": [ - { - "id": "group-1", - "title": "Calculated Summary group", - "blocks": [ - { - "type": "Question", - "id": "first-number-block", - "question": { - "id": "first-number-question", - "title": "First Number Question Title", - "type": "General", - "answers": [ - { - "id": "first-number-answer", - "label": "First answer label", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "second-number-block", - "question": { - "id": "second-number-question", - "title": "Second Number Question Title", - "type": "General", - "answers": [ - { - "id": "second-number-answer", - "label": "Second answer label", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-block", - "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "first-number-answer" - }, - { - "source": "answers", - "identifier": "second-number-answer" - } - ] - }, - "title": "Grand total of previous values" - } - } - ] - } - ] - }, - { - "id": "section-2", - "title": "Skippable random question + List collector", - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "type": "Question", - "id": "s2-b1", - "question": { - "id": "s2-b1-q1", - "title": "Skippable random question", - "type": "General", - "answers": [ - { - "id": "s2-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "block", - "identifier": "calculated-summary-block" - }, - "COMPLETED" - ] - } - } - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "section-3", - "title": "Repeating section", - "summary": { "show_on_completion": true }, - "repeat": { - "for_list": "people", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "groups": [ - { - "id": "dob-group", - "title": "Date of birth", - "blocks": [ - { - "type": "Question", - "id": "dob-block", - "question": { - "answers": [ - { - "id": "date-of-birth-answer", - "mandatory": false, - "maximum": { - "value": "now" - }, - "minimum": { - "offset_by": { - "years": -115 - }, - "value": "2019-10-13" - }, - "type": "Date" - } - ], - "guidance": { - "contents": [ - { - "description": "For example 31 12 1970" - } - ] - }, - "id": "date-of-birth-question", - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "What is {person_name_possessive} date of birth?" - }, - "type": "General" - } - }, - { - "type": "Question", - "id": "other-question-block", - "question": { - "id": "other-question", - "answers": [ - { - "id": "other-answer", - "mandatory": true, - "label": "Anything", - "type": "Number" - } - ], - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "Random question about {person_name_possessive}" - }, - "description": ["Shows because the calculated summary was completed in section 1"], - "type": "General" - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "block", - "identifier": "calculated-summary-block" - }, - "COMPLETED" - ] - } - } - }, - { - "type": "Question", - "id": "other-question-block-2", - "question": { - "id": "other-question-2", - "answers": [ - { - "id": "other-answer-2", - "mandatory": true, - "label": "Anything", - "type": "Number" - } - ], - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "Another random question about {person_name_possessive}" - }, - "description": ["Shows because block 2 of this repeating section was completed."], - "type": "General" - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "block", - "identifier": "other-question-block" - }, - "COMPLETED" - ] - } - } - } - ] - } - ] - }, - { - "id": "section-4", - "title": "Section 4 (Dependent on Section 1)", - "groups": [ - { - "id": "group-4", - "title": "List", - "blocks": [ - { - "type": "Question", - "id": "s4-b1", - "question": { - "id": "s4-b1-q1", - "title": "Skippable random question", - "type": "General", - "answers": [ - { - "id": "s4-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-1" - }, - "COMPLETED" - ] - } - } - }, - { - "type": "Question", - "id": "s4-b2", - "question": { - "id": "s4-b2-q1", - "title": "Random question", - "type": "General", - "answers": [ - { - "id": "s4-b2-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ] - } - ] - }, - { - "id": "section-5", - "title": "Section 5 (Dependent on Calc Summary Block Section 1)", - "groups": [ - { - "id": "group-5", - "title": "List", - "blocks": [ - { - "type": "Question", - "id": "s5-b1", - "question": { - "id": "s5-b1-q1", - "title": "Skippable random question", - "type": "General", - "answers": [ - { - "id": "s5-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "block", - "identifier": "calculated-summary-block" - }, - "COMPLETED" - ] - } - } - }, - { - "type": "Question", - "id": "s5-b2", - "question": { - "id": "s5-b2-q1", - "title": "Random question", - "type": "General", - "answers": [ - { - "id": "s5-b2-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ] - } - ] - }, - { - "id": "section-6", - "title": "Section 6 (Dependent on Section 4)", - "groups": [ - { - "id": "group-6", - "title": "List", - "blocks": [ - { - "type": "Question", - "id": "s6-b1", - "question": { - "id": "s6-b1-q1", - "title": "Skippable random question", - "type": "General", - "answers": [ - { - "id": "s6-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-4" - }, - "COMPLETED" - ] - } - } - }, - { - "type": "Question", - "id": "s6-b2", - "question": { - "id": "s6-b2-q1", - "title": "Random question", - "type": "General", - "answers": [ - { - "id": "s6-b2-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ] - } - ] - }, - { - "id": "section-7", - "title": "Section 7 (Dependent on Section 5)", - "groups": [ - { - "id": "group-7", - "title": "List", - "blocks": [ - { - "type": "Question", - "id": "s7-b1", - "question": { - "id": "s7-b1-q1", - "title": "Skippable random question", - "type": "General", - "answers": [ - { - "id": "s7-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-5" - }, - "COMPLETED" - ] - } - } - }, - { - "type": "Question", - "id": "s7-b2", - "question": { - "id": "s7-b2-q1", - "title": "Skippable random question", - "type": "General", - "answers": [ - { - "id": "s7-b2-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-2" - }, - "COMPLETED" - ] - } - } - }, - { - "type": "Question", - "id": "s7-b3", - "question": { - "id": "s7-b3-q1", - "title": "Random question", - "type": "General", - "answers": [ - { - "id": "s7-b3-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ] - } - ] - }, - { - "id": "section-8", - "title": "Section 8 (Dependent on Section 7 and Section 2)", - "groups": [ - { - "id": "group-8", - "title": "List", - "blocks": [ - { - "type": "Question", - "id": "s8-b1", - "question": { - "id": "s8-b1-q1", - "title": "Skippable random question", - "type": "General", - "answers": [ - { - "id": "s8-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-7" - }, - "COMPLETED" - ] - } - } - }, - { - "type": "Question", - "id": "s8-b2", - "question": { - "id": "s8-b2-q1", - "title": "Skippable random question", - "type": "General", - "answers": [ - { - "id": "s8-b2-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-2" - }, - "COMPLETED" - ] - } - } - }, - { - "type": "Question", - "id": "s8-b3", - "question": { - "id": "s8-b3-q1", - "title": "Random question", - "type": "General", - "answers": [ - { - "id": "s8-b3-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ] - } - ] - }, - { - "id": "section-9", - "title": "Section 9 (Dependent on Section 2)", - "groups": [ - { - "id": "group-9", - "title": "List", - "blocks": [ - { - "type": "Question", - "id": "s9-b1", - "question": { - "id": "s9-b1-q1", - "title": "Skippable random question", - "type": "General", - "answers": [ - { - "id": "s9-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-2" - }, - "COMPLETED" - ] - } - } - }, - { - "type": "Question", - "id": "s9-b2", - "question": { - "id": "s9-b2-q1", - "title": "Random question", - "type": "General", - "answers": [ - { - "id": "s9-b2-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ] - } - ] - }, - { - "id": "section-10", - "title": "Section 10 (Dependent on Section 2)", - "groups": [ - { - "id": "group-10", - "title": "List", - "blocks": [ - { - "type": "Question", - "id": "s10-b1", - "question": { - "id": "s10-b1-q1", - "title": "Skippable random question", - "type": "General", - "answers": [ - { - "id": "s10-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-2" - }, - "COMPLETED" - ] - } - } - }, - { - "type": "Question", - "id": "s10-b2", - "question": { - "id": "s10-b2-q1", - "title": "Random question", - "type": "General", - "answers": [ - { - "id": "s10-b2-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ] - } - ] - }, - { - "id": "section-11", - "title": "Section 11 (Dependent on Section 10)", - "groups": [ - { - "id": "group-11", - "title": "List", - "blocks": [ - { - "type": "Question", - "id": "s11-b1", - "question": { - "id": "s11-b1-q1", - "title": "Skippable random question", - "type": "General", - "answers": [ - { - "id": "s11-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-10" - }, - "COMPLETED" - ] - } - } - }, - { - "type": "Question", - "id": "s11-b2", - "question": { - "id": "s11-b2-q1", - "title": "Random question", - "type": "General", - "answers": [ - { - "id": "s11-b2-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ] - } - ] - }, - { - "id": "section-12", - "title": "Section 12 (Dependent on Section 9)", - "groups": [ - { - "id": "group-12", - "title": "List", - "blocks": [ - { - "type": "Question", - "id": "s12-b1", - "question": { - "id": "s12-b1-q1", - "title": "Skippable random question", - "type": "General", - "answers": [ - { - "id": "s12-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-9" - }, - "COMPLETED" - ] - } - } - }, - { - "type": "Question", - "id": "s12-b2", - "question": { - "id": "s12-b2-q1", - "title": "Random question", - "type": "General", - "answers": [ - { - "id": "s12-b2-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_progress_value_source_repeating_sections_chained_dependencies.json b/schemas/test/en/test_progress_value_source_repeating_sections_chained_dependencies.json deleted file mode 100644 index 390821f170..0000000000 --- a/schemas/test/en/test_progress_value_source_repeating_sections_chained_dependencies.json +++ /dev/null @@ -1,490 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "survey_id": "139", - "theme": "default", - "title": "Progress Value Source Repeating Sections With Chained Dependencies Test", - "data_version": "0.0.3", - "description": "Progress Value Source Repeating Sections Test", - "navigation": { - "visible": true - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "trad_as", - "type": "string", - "optional": true - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section-1", - "title": "Section 1", - "groups": [ - { - "id": "group-1", - "title": "List", - "blocks": [ - { - "type": "Question", - "id": "s1-b2", - "question": { - "id": "s1-b1-q1", - "title": "Random question", - "type": "General", - "answers": [ - { - "id": "s1-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ] - } - ] - }, - { - "id": "section-2", - "title": "Section 2 (Dependent on Section 1)", - "groups": [ - { - "id": "group-2", - "title": "List", - "blocks": [ - { - "type": "Question", - "id": "s2-b1", - "question": { - "id": "s2-b1-q1", - "title": "Skippable random question", - "type": "General", - "answers": [ - { - "id": "s2-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-1" - }, - "COMPLETED" - ] - } - } - }, - { - "type": "Question", - "id": "s2-b2", - "question": { - "id": "s2-b2-q1", - "title": "Random question", - "type": "General", - "answers": [ - { - "id": "s2-b2-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ] - } - ] - }, - { - "id": "section-3", - "title": "Section 3 (Depends on Section 2)", - "groups": [ - { - "id": "group", - "title": "Second List Collector", - "blocks": [ - { - "id": "second-list-collector", - "type": "ListCollector", - "for_list": "second-people", - "question": { - "id": "second-confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "second-anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "second-add-person", - "type": "ListAddQuestion", - "question": { - "id": "second-add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "second-first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "second-last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "second-edit-person", - "type": "ListEditQuestion", - "question": { - "id": "second-edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "second-first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "second-last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "second-remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "second-remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "second-remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "second-first-name" - }, - { - "source": "answers", - "identifier": "second-last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "type": "Question", - "id": "second-question-block", - "question": { - "id": "second-question", - "title": "Question", - "type": "General", - "answers": [ - { - "id": "second-answer", - "mandatory": false, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-2" - }, - "COMPLETED" - ] - } - } - }, - { - "type": "Question", - "id": "second-random-question-enabler-block", - "question": { - "id": "second-random-question-enabler-question", - "title": "Random question enabler", - "description": [ - "Answering this question will enable the random question in the repeated section coming after the list collector." - ], - "type": "General", - "answers": [ - { - "id": "second-random-question-enabler-answer", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ] - } - ] - }, - { - "id": "section-4", - "title": "Section 4 - Repeat (Depends on section 3)", - "summary": { "show_on_completion": true }, - "repeat": { - "for_list": "second-people", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "second-first-name" - }, - { - "source": "answers", - "identifier": "second-last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "groups": [ - { - "id": "second-dob-group", - "title": "Date of birth", - "blocks": [ - { - "type": "Question", - "id": "second-dob-block", - "question": { - "answers": [ - { - "id": "second-date-of-birth-answer", - "mandatory": false, - "maximum": { - "value": "now" - }, - "minimum": { - "offset_by": { - "years": -115 - }, - "value": "2019-10-13" - }, - "type": "Date" - } - ], - "guidance": { - "contents": [ - { - "description": "For example 31 12 1970" - } - ] - }, - "id": "second-date-of-birth-question", - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "second-first-name" - }, - { - "source": "answers", - "identifier": "second-last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "What is {person_name_possessive} date of birth?" - }, - "type": "General" - } - }, - { - "type": "Question", - "id": "second-other-question-block", - "question": { - "id": "second-other-question", - "answers": [ - { - "id": "second-other-answer", - "mandatory": true, - "label": "Anything", - "type": "Number" - } - ], - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "second-first-name" - }, - { - "source": "answers", - "identifier": "second-last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "Random question about {person_name_possessive}" - }, - "description": ["Shows because section 2 was completed"], - "type": "General" - }, - "skip_conditions": { - "when": { - "!=": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-2" - }, - "COMPLETED" - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_progress_value_source_section_enabled_hub.json b/schemas/test/en/test_progress_value_source_section_enabled_hub.json deleted file mode 100644 index e3babd5cb2..0000000000 --- a/schemas/test/en/test_progress_value_source_section_enabled_hub.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test progress value source", - "theme": "default", - "description": "A test survey for testing progress value source section enabled in a hub flow", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section-1", - "title": "Section 1", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "s1-b1", - "question": { - "id": "s1-b1-q1", - "title": "Section 1 Question 1", - "description": ["Always shows"], - "type": "General", - "answers": [ - { - "id": "s1-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - }, - { - "type": "Question", - "id": "s1-b2", - "question": { - "id": "s1-b2-q1", - "title": "Section 1 Question 2", - "type": "General", - "answers": [ - { - "id": "s1-b2-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ], - "id": "group-1" - } - ] - }, - { - "id": "section-2", - "title": "Section 2", - "enabled": { - "when": { - "==": [{ "source": "progress", "selector": "section", "identifier": "section-1" }, "COMPLETED"] - } - }, - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "s2-b1", - "question": { - "id": "s2-b1-q1", - "title": "Section 2 Question 1", - "description": ["This question always shows"], - "type": "General", - "answers": [ - { - "id": "s2-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ], - "id": "group-2" - } - ] - } - ] -} diff --git a/schemas/test/en/test_progress_value_source_section_enabled_hub_complex.json b/schemas/test/en/test_progress_value_source_section_enabled_hub_complex.json deleted file mode 100644 index 4d647dbdb6..0000000000 --- a/schemas/test/en/test_progress_value_source_section_enabled_hub_complex.json +++ /dev/null @@ -1,251 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test progress value source", - "theme": "default", - "description": "A test survey for testing progress value source section enabled in a hub flow, with a mixture of skip conditions and section enabled conditions, and a mix of block and section references", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section-1", - "title": "Section 1", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "s1-b1", - "question": { - "id": "s1-b1-q1", - "title": "Section 1 Question 1", - "description": ["Always shows. The next question in the section also shows when the answer is not 0"], - "type": "General", - "answers": [ - { - "id": "s1-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "routing_rules": [ - { - "when": { - "!=": [ - { - "identifier": "s1-b1-q1-a1", - "source": "answers" - }, - 0 - ] - }, - "block": "s1-b2" - }, - { - "section": "End" - } - ] - }, - { - "type": "Question", - "id": "s1-b2", - "question": { - "id": "s1-b2-q1", - "title": "Section 1 Question 2", - "type": "General", - "description": ["Shows if the answer to the previous question is not 0"], - "answers": [ - { - "id": "s1-b2-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ], - "id": "group-1" - } - ] - }, - { - "id": "section-2", - "title": "Section 2", - "enabled": { - "when": { - "==": [{ "source": "progress", "selector": "section", "identifier": "section-1" }, "COMPLETED"] - } - }, - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "s2-b1", - "question": { - "id": "s2-b1-q1", - "title": "Section 2 Question 1", - "description": ["This question always shows. The next question in the section also shows when the answer is not 0"], - "type": "General", - "answers": [ - { - "id": "s2-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - }, - { - "type": "Question", - "id": "s2-b2", - "question": { - "id": "s2-b2-q1", - "title": "Section 2 Question 2", - "type": "General", - "description": ["Always shows"], - "answers": [ - { - "id": "s2-b2-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - }, - "routing_rules": [ - { - "when": { - "!=": [ - { - "identifier": "s2-b1-q1-a1", - "source": "answers" - }, - 0 - ] - }, - "block": "s2-b3" - }, - { - "section": "End" - } - ] - }, - { - "type": "Question", - "id": "s2-b3", - "question": { - "id": "s2-b3-q1", - "title": "Section 2 Question 3", - "type": "General", - "description": ["Shows if the answer to the Section 2 Question 1 is not 0"], - "answers": [ - { - "id": "s2-b3-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ], - "id": "group-2" - } - ] - }, - { - "id": "section-3", - "title": "Section 3", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "s3-b1", - "question": { - "id": "s3-b1-q1", - "title": "Section 3 Question 1", - "description": ["Always shows"], - "type": "General", - "answers": [ - { - "id": "s3-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ], - "id": "group-3" - } - ] - }, - { - "id": "section-4", - "title": "Section 4", - "enabled": { - "when": { - "and": [ - { - "==": [{ "source": "progress", "selector": "block", "identifier": "s2-b2" }, "COMPLETED"] - }, - { - "==": [{ "source": "progress", "selector": "section", "identifier": "section-2" }, "COMPLETED"] - } - ] - } - }, - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "s4-b1", - "question": { - "id": "s4-b1-q1", - "title": "Section 4 Question 1", - "description": ["This section shows if section 2 block 2 is completed, as well as section 2"], - "type": "General", - "answers": [ - { - "id": "s4-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ], - "id": "group-4" - } - ] - } - ] -} diff --git a/schemas/test/en/test_progress_value_source_section_enabled_no_hub.json b/schemas/test/en/test_progress_value_source_section_enabled_no_hub.json deleted file mode 100644 index a9f88839d2..0000000000 --- a/schemas/test/en/test_progress_value_source_section_enabled_no_hub.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test progress value source", - "theme": "default", - "description": "A test survey for testing progress value source section enabled in a linear flow", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section-1", - "title": "Section 1", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "s1-b1", - "question": { - "id": "s1-b1-q1", - "title": "Section 1 Question 1", - "description": ["Always shows"], - "type": "General", - "answers": [ - { - "id": "s1-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - }, - { - "type": "Question", - "id": "s1-b2", - "question": { - "id": "s1-b2-q1", - "title": "Section 1 Question 2", - "type": "General", - "answers": [ - { - "id": "s1-b2-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ], - "id": "group-1" - } - ] - }, - { - "id": "section-2", - "title": "Section 2", - "enabled": { - "when": { - "==": [{ "source": "progress", "selector": "section", "identifier": "section-1" }, "COMPLETED"] - } - }, - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "s2-b1", - "question": { - "id": "s2-b1-q1", - "title": "Section 2 Question 1", - "description": ["This question always shows"], - "type": "General", - "answers": [ - { - "id": "s2-b1-q1-a1", - "mandatory": true, - "label": "Enter any number", - "type": "Number" - } - ] - } - } - ], - "id": "group-2" - } - ] - } - ] -} diff --git a/schemas/test/en/test_question_definition.json b/schemas/test/en/test_question_definition.json deleted file mode 100644 index 9233ebff3d..0000000000 --- a/schemas/test/en/test_question_definition.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Other input fields", - "theme": "default", - "description": "A questionnaire to test definitions.", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "definition-group", - "blocks": [ - { - "type": "Question", - "id": "definition-block", - "question": { - "id": "question", - "title": "Do you connect a LiFePO4 battery to your photovoltaic system to store surplus energy?", - "type": "General", - "definition": { - "title": "What is a photovoltaic system?", - "contents": [ - { - "description": "A typical photovoltaic system employs solar panels, each comprising a number of solar cells, which generate electrical power. PV installations may be ground-mounted, rooftop mounted or wall mounted. The mount may be fixed, or use a solar tracker to follow the sun across the sky." - } - ] - }, - "answers": [ - { - "type": "Radio", - "id": "radio-mandatory-answer", - "mandatory": false, - "options": [ - { - "label": "Yes, I do connect a battery", - "value": "Yes, I do connect a battery" - }, - { - "label": "No, I don’t connect a battery", - "value": "No, I don’t connect a battery" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_question_definition_array_type.json b/schemas/test/en/test_question_definition_array_type.json deleted file mode 100644 index f691d55993..0000000000 --- a/schemas/test/en/test_question_definition_array_type.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Other input fields", - "theme": "default", - "description": "A questionnaire to test definitions (array type).", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "definition-group", - "blocks": [ - { - "type": "Question", - "id": "definition-block", - "question": { - "id": "question", - "title": "Do you connect a LiFePO4 battery to your photovoltaic system to store surplus energy?", - "type": "General", - "definitions": [ - { - "title": "What is a photovoltaic system?", - "contents": [ - { - "description": "A typical photovoltaic system employs solar panels, each comprising a number of solar cells, which generate electrical power. PV installations may be ground-mounted, rooftop mounted or wall mounted. The mount may be fixed, or use a solar tracker to follow the sun across the sky." - } - ] - } - ], - "answers": [ - { - "type": "Radio", - "id": "radio-mandatory-answer", - "mandatory": false, - "options": [ - { - "label": "Yes, I do connect a battery", - "value": "Yes, I do connect a battery" - }, - { - "label": "No, I don’t connect a battery", - "value": "No, I don’t connect a battery" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_question_description.json b/schemas/test/en/test_question_description.json deleted file mode 100644 index 4904ec7083..0000000000 --- a/schemas/test/en/test_question_description.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Other input fields", - "theme": "default", - "description": "A questionnaire to demo checkbox field Other input.", - "messages": { - "NUMBER_TOO_LARGE": "Number is too large", - "NUMBER_TOO_SMALL": "Number cannot be less than zero", - "INVALID_NUMBER": "Please enter an integer" - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "name-block", - "question": { - "description": ["Answer the question", "Go on"], - "answers": [ - { - "id": "name-answer", - "label": "What is your name?", - "max_length": 20, - "mandatory": false, - "type": "TextField" - } - ], - "id": "name-question", - "title": "Title", - "type": "General" - } - } - ], - "id": "checkboxes", - "title": "Title" - } - ] - } - ] -} diff --git a/schemas/test/en/test_question_guidance.json b/schemas/test/en/test_question_guidance.json deleted file mode 100644 index 5cc4695019..0000000000 --- a/schemas/test/en/test_question_guidance.json +++ /dev/null @@ -1,310 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Question Guidance Test", - "theme": "default", - "description": "A questionnaire to test question guidance content", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "group", - "blocks": [ - { - "type": "Introduction", - "id": "introduction" - }, - { - "type": "Question", - "id": "block-test-guidance-title", - "question": { - "id": "question-test-guidance-title", - "title": "Question: Test guidance title", - "description": ["Testing combinations of the title within guidance"], - "guidance": { - "contents": [ - { - "title": "This one has a description but no list" - }, - { - "description": "No list items below this text" - }, - { - "title": "This one has no list or description" - }, - { - "description": "title, description, title, description" - } - ] - }, - "type": "General", - "answers": [ - { - "id": "answer-test-guidance-title", - "label": "Text question", - "mandatory": false, - "type": "TextField" - } - ] - } - }, - { - "type": "Question", - "id": "block-test-guidance-description", - "question": { - "id": "question-test-guidance-description", - "title": "Question: Test guidance descriptions", - "description": ["Tests the descriptions within guidance"], - "guidance": { - "contents": [ - { - "description": "No title above this text, list below" - }, - { - "list": ["Item Include 1", "Item Include 2", "Item Include 3", "Item Include 4"] - }, - { - "description": "Just description, no title above this text, no list below" - } - ] - }, - "type": "General", - "answers": [ - { - "id": "answer-test-guidance-description", - "label": "Text question", - "mandatory": false, - "type": "TextField" - } - ] - } - }, - { - "type": "Question", - "id": "block-test-guidance-lists", - "question": { - "id": "question-test-guidance-lists", - "title": "Question: Test guidance lists (with no question description below)", - "guidance": { - "contents": [ - { - "title": "Title, no description, list follows", - "list": ["Item Include 1", "Item Include 2", "Item Include 3", "Item Include 4"] - }, - { - "list": [ - "List with no title or description 1", - "List with no title or description 2", - "List with no title or description 3", - "List with no title or description 4" - ] - } - ] - }, - "type": "General", - "answers": [ - { - "id": "answer-test-guidance-lists", - "label": "Text question", - "mandatory": false, - "type": "TextField" - } - ] - } - }, - { - "type": "Question", - "id": "block-test-guidance-content-description", - "question": { - "id": "question-test-guidance-content-description", - "title": "Question: Test show guidance content description", - "guidance": { - "contents": [ - { - "description": "Guidance with content description" - } - ] - }, - "type": "General", - "answers": [ - { - "guidance": { - "show_guidance": "Show test guidance.", - "hide_guidance": "Hide test guidance.", - "contents": [ - { - "description": "The text here is for description" - } - ] - }, - "id": "answer-test-guidance-content-description", - "label": "Text question", - "mandatory": false, - "type": "TextField" - } - ] - } - }, - { - "type": "Question", - "id": "block-test-guidance-content-title", - "question": { - "id": "question-test-guidance-content-title", - "title": "Question: Test show guidance content title", - "guidance": { - "contents": [ - { - "description": "Guidance with content title" - } - ] - }, - "type": "General", - "answers": [ - { - "guidance": { - "show_guidance": "Show test guidance.", - "hide_guidance": "Hide test guidance.", - "contents": [ - { - "title": "The text here is for a title" - } - ] - }, - "id": "answer-test-guidance-content-title", - "label": "Text question", - "mandatory": false, - "type": "TextField" - } - ] - } - }, - { - "type": "Question", - "id": "block-test-guidance-content-list", - "question": { - "id": "question-test-guidance-content-list", - "title": "Question: Test show guidance content list", - "guidance": { - "contents": [ - { - "title": "Guidance with content list" - } - ] - }, - "type": "General", - "answers": [ - { - "guidance": { - "show_guidance": "Show test guidance.", - "hide_guidance": "Hide test guidance.", - "contents": [ - { - "list": ["The text here is for a list", "Another list item", "One more"] - } - ] - }, - "id": "answer-test-guidance-content-list", - "label": "Text question", - "mandatory": false, - "type": "TextField" - } - ] - } - }, - { - "type": "Question", - "id": "block-test-guidance-all", - "question": { - "id": "question-test-guidance-all", - "title": "Question: Test guidance all", - "description": ["Testing all features of the guidance block enabled together"], - "guidance": { - "contents": [ - { - "title": "Include" - }, - { - "description": "

Guidance include description text

" - }, - { - "list": ["Item Include 1", "Item Include 2", "Item Include 3", "Item Include 4"] - }, - { - "title": "Exclude" - }, - { - "description": "

Guidance exclude description text

" - }, - { - "list": ["Item Exclude 1", "Item Exclude 2", "Item Exclude 3", "Item Exclude 4"] - }, - { - "title": "Other" - }, - { - "description": "

Guidance other description text

" - }, - { - "list": ["Item Other 1", "Item Other 2", "Item Other 3", "Item Other 4"] - } - ] - }, - "type": "General", - "answers": [ - { - "guidance": { - "show_guidance": "Show test guidance.", - "hide_guidance": "Hide test guidance.", - "contents": [ - { - "description": "The text here is for a description" - }, - { - "description": "Here’s some more description text" - }, - { - "title": "This text here is the title for the list", - "list": ["The text here is for a list", "Another list item", "One more"] - } - ] - }, - "id": "answer-test-guidance-all", - "label": "Text question", - "mandatory": false, - "type": "TextField" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_question_title_in_error.json b/schemas/test/en/test_question_title_in_error.json deleted file mode 100644 index 9a4d97b934..0000000000 --- a/schemas/test/en/test_question_title_in_error.json +++ /dev/null @@ -1,160 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Question Validation Test", - "theme": "default", - "description": "A questionnaire to test use of the question title in validation", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "mutually-exclusive-checkbox-section", - "groups": [ - { - "id": "mutually-exclusive-mandatory-group", - "title": "Mutually Exclusive Group", - "blocks": [ - { - "type": "Question", - "id": "mandatory-checkbox", - "question": { - "answers": [ - { - "id": "mandatory-checkbox-answer", - "mandatory": true, - "options": [ - { - "label": "Cheese", - "value": "Cheese" - }, - { - "label": "Ham", - "value": "Ham" - }, - { - "label": "Pineapple", - "value": "Pineapple" - }, - { - "label": "Tuna", - "value": "Tuna" - }, - { - "label": "Pepperoni", - "value": "Pepperoni" - }, - { - "label": "Other", - "description": "Choose any other topping", - "value": "Other", - "detail_answer": { - "mandatory": true, - "id": "other-answer-mandatory", - "label": "Please specify other", - "type": "TextField" - } - } - ], - "type": "Checkbox" - } - ], - "id": "mandatory-checkbox-question", - "title": "Which pizza toppings would you like?", - "type": "General" - } - }, - { - "type": "Question", - "id": "mutually-exclusive-checkbox", - "question": { - "id": "mutually-exclusive-checkbox-question", - "type": "MutuallyExclusive", - "title": { - "text": "Did you really answer ‘{topping_answers}’ to the previous question?", - "placeholders": [ - { - "placeholder": "topping_answers", - "transforms": [ - { - "arguments": { - "delimiter": ", ", - "list_to_concatenate": [ - { - "identifier": "mandatory-checkbox-answer", - "source": "answers" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - }, - "mandatory": true, - "answers": [ - { - "id": "checkbox-answer", - "instruction": "Select answer", - "type": "Checkbox", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - }, - { - "id": "checkbox-exclusive-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "I prefer not to say", - "description": "Some description", - "value": "I prefer not to say" - } - ] - } - ], - "validation": { - "messages": { - "MANDATORY_QUESTION": "Select an answer to ‘%(question_title)s’ to continue" - } - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_radio_checkbox_descriptions.json b/schemas/test/en/test_radio_checkbox_descriptions.json deleted file mode 100644 index 9e7011aad6..0000000000 --- a/schemas/test/en/test_radio_checkbox_descriptions.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Survey - Checkbox and Radio option descriptions", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "radio-checkbox-descriptio", - "title": "Did this business make major changes in the following areas?", - "blocks": [ - { - "type": "Question", - "id": "checkbox-block", - "question": { - "answers": [ - { - "id": "checkbox-answer", - "label": "Did this business make major changes in the following areas?", - "mandatory": true, - "options": [ - { - "label": "New business practices for organising procedures", - "value": "New business practices for organising procedures", - "description": "For example supply chain management, business re-engineering, knowledge management, lean production, quality management" - }, - { - "label": "New methods of organising work responsibilities and decision making", - "value": "New methods of organising work responsibilities and decision making", - "description": "For example first use of a new system of employee responsibilities, team work, decentralisation, integration or de-integration of departments, education / training systems" - }, - { - "label": "New methods of organising external relationships with other firms or public institutions", - "value": "New methods of organising external relationships with other firms or public institutions", - "description": "For example first use of alliances, partnerships, outsourcing or sub-contracting" - }, - { - "label": "Implementation of changes to marketing concepts or strategies", - "value": "Implementation of changes to marketing concepts or strategies" - } - ], - "type": "Checkbox", - "validation": { - "messages": {} - } - } - ], - "id": "checkbox-question", - "title": "Did this business make major changes in the following areas?", - "type": "General" - } - }, - { - "type": "Question", - "id": "radio-block", - "question": { - "answers": [ - { - "id": "radio-answer", - "label": "Did this business make major changes in the following areas?", - "mandatory": true, - "options": [ - { - "label": "New business practices for organising procedures", - "value": "New business practices for organising procedures", - "description": "For example supply chain management, business re-engineering, knowledge management, lean production, quality management" - }, - { - "label": "New methods of organising work responsibilities and decision making", - "value": "New methods of organising work responsibilities and decision making", - "description": "For example first use of a new system of employee responsibilities, team work, decentralisation, integration or de-integration of departments, education / training systems" - }, - { - "label": "New methods of organising external relationships with other firms or public institutions", - "value": "New methods of organising external relationships with other firms or public institutions", - "description": "For example first use of alliances, partnerships, outsourcing or sub-contracting" - }, - { - "label": "Implementation of changes to marketing concepts or strategies", - "value": "Implementation of changes to marketing concepts or strategies" - } - ], - "type": "Radio", - "validation": { - "messages": {} - } - } - ], - "id": "radio-question", - "title": "Did this business make major changes in the following areas?", - "type": "General" - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_radio_detail_answer_dropdown.json b/schemas/test/en/test_radio_detail_answer_dropdown.json deleted file mode 100644 index 3e576dac95..0000000000 --- a/schemas/test/en/test_radio_detail_answer_dropdown.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Radio with Dropdown Detail Answer", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "radio", - "title": "Dropdown Radio with detail answer", - "blocks": [ - { - "type": "Question", - "id": "optional-radio-with-dropdown-detail-answer-block", - "question": { - "type": "General", - "id": "optional-radio-with-dropdown-detail-answer-question", - "title": "What is your favourite Ice Cream topping?", - "guidance": { - "contents": [ - { - "list": ["Fruit detail answer is optional", "Jam detail answer is mandatory"] - } - ] - }, - "answers": [ - { - "type": "Radio", - "id": "optional-radio-with-dropdown-detail-answer", - "label": "Select your favourite toppings", - "mandatory": false, - "options": [ - { - "label": "Sprinkles", - "value": "Sprinkles" - }, - { - "label": "Fruit", - "value": "Fruit", - "detail_answer": { - "type": "Dropdown", - "id": "optional-radio-with-optional-dropdown-detail-answer", - "mandatory": false, - "label": "Please specify type", - "placeholder": "Select fruit", - "options": [ - { - "label": "Mango", - "value": "Mango" - }, - { - "label": "Pineapple", - "value": "Pineapple" - }, - { - "label": "Peach", - "value": "Peach" - } - ] - } - }, - { - "label": "Jam", - "value": "Jam", - "detail_answer": { - "type": "Dropdown", - "id": "optional-radio-with-mandatory-dropdown-detail-answer", - "mandatory": true, - "label": "Please specify type", - "validation": { - "messages": { - "MANDATORY_DROPDOWN": "Please select the type of Jam" - } - }, - "options": [ - { - "label": "Strawberry", - "value": "Strawberry" - }, - { - "label": "Raspberry", - "value": "Raspberry" - }, - { - "label": "Apricot", - "value": "Apricot" - } - ] - } - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_radio_detail_answer_multiple.json b/schemas/test/en/test_radio_detail_answer_multiple.json deleted file mode 100644 index 69d848c21f..0000000000 --- a/schemas/test/en/test_radio_detail_answer_multiple.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Radio Mandatory with Mandatory Detail Answer Overridden Error", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "radio", - "title": "Radio Mandatory with Mandatory Detail Answer Overridden Error", - "blocks": [ - { - "type": "Question", - "id": "radio-mandatory", - "question": { - "type": "General", - "id": "radio-mandatory-question", - "title": "What is you favourite breakfast item?", - "answers": [ - { - "type": "Radio", - "id": "radio-mandatory-answer", - "mandatory": true, - "options": [ - { - "label": "Toast", - "value": "Toast" - }, - { - "label": "Eggs", - "value": "Eggs", - "detail_answer": { - "mandatory": false, - "id": "eggs-answer", - "label": "Please write your favourite egg type", - "type": "TextField" - } - }, - { - "label": "Favourite not listed", - "description": "An answer is required.", - "value": "Favourite not listed", - "detail_answer": { - "mandatory": true, - "id": "alternate-answer", - "label": "Please write your favourite", - "type": "TextField", - "validation": { - "messages": { - "MANDATORY_TEXTFIELD": "Enter your favourite to continue" - } - } - } - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_radio_detail_answer_numeric.json b/schemas/test/en/test_radio_detail_answer_numeric.json deleted file mode 100644 index c2613bc86f..0000000000 --- a/schemas/test/en/test_radio_detail_answer_numeric.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Numeric Radio with other", - "theme": "default", - "messages": { - "NUMBER_TOO_LARGE": "Number is too large", - "NUMBER_TOO_SMALL": "Number cannot be less than zero", - "INVALID_NUMBER": "Please enter an integer" - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "radio", - "title": "Numeric Radio with detail answer", - "blocks": [ - { - "type": "Question", - "id": "radio-numeric-detail", - "question": { - "type": "General", - "id": "radio-question-numeric-detail", - "title": "How many items would you like on your breakfast?", - "answers": [ - { - "type": "Radio", - "validation": { - "messages": {} - }, - "id": "radio-answer-numeric-detail", - "mandatory": false, - "options": [ - { - "label": "1", - "value": "1" - }, - { - "label": "2", - "value": "2" - }, - { - "label": "None", - "value": "None" - }, - { - "label": "Other", - "value": "Other", - "detail_answer": { - "mandatory": false, - "id": "other-answer", - "label": "Please enter a number of items", - "type": "Number", - "maximum": { - "value": 20 - } - } - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_radio_detail_answer_visible.json b/schemas/test/en/test_radio_detail_answer_visible.json deleted file mode 100644 index 1abcffcdd5..0000000000 --- a/schemas/test/en/test_radio_detail_answer_visible.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Radio Visible", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section-1", - "groups": [ - { - "id": "radio", - "title": "Radio Open", - "blocks": [ - { - "type": "Question", - "id": "radio-visible-true", - "question": { - "type": "General", - "id": "radio-visible-true-question", - "title": "What is your favourite drink?", - "answers": [ - { - "type": "Radio", - "id": "radio-visible-true-answer", - "mandatory": false, - "voluntary": true, - "options": [ - { - "label": "Coffee", - "value": "Coffee" - }, - { - "detail_answer": { - "id": "radio-visible-true-answer-other", - "label": "Enter your favourite drink", - "mandatory": false, - "visible": true, - "type": "TextField" - }, - "label": "Other", - "value": "Other" - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "radio-visible-false", - "question": { - "type": "General", - "id": "radio-visible-false-question", - "title": "What is your favourite food?", - "answers": [ - { - "type": "Radio", - "id": "radio-visible-false-answer", - "mandatory": false, - "voluntary": false, - "options": [ - { - "label": "Ice cream", - "value": "Ice cream" - }, - { - "description": "Select to enter answer", - "detail_answer": { - "id": "radio-visible-false-answer-other", - "label": "Enter your favourite food", - "mandatory": false, - "visible": false, - "type": "TextField" - }, - "label": "Other", - "value": "Other" - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "radio-visible-none", - "question": { - "type": "General", - "id": "radio-visible-none-question", - "title": "What is your favourite colour?", - "answers": [ - { - "type": "Radio", - "id": "radio-visible-none-answer", - "mandatory": false, - "voluntary": false, - "options": [ - { - "label": "Blue", - "value": "Blue" - }, - { - "description": "Select to enter answer", - "detail_answer": { - "id": "radio-visible-none-answer-other", - "label": "Enter your favourite colour", - "mandatory": false, - "type": "TextField" - }, - "label": "Other", - "value": "Other" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_radio_mandatory.json b/schemas/test/en/test_radio_mandatory.json deleted file mode 100644 index 1af1f48d03..0000000000 --- a/schemas/test/en/test_radio_mandatory.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Radio Mandatory", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "radio", - "title": "Radio Mandatory", - "blocks": [ - { - "type": "Question", - "id": "radio-mandatory", - "question": { - "type": "General", - "id": "radio-mandatory-question", - "title": "What do you prefer for breakfast?", - "answers": [ - { - "type": "Radio", - "id": "radio-mandatory-answer", - "mandatory": true, - "options": [ - { - "label": "Coffee", - "value": "Coffee" - }, - { - "label": "Tea", - "value": "Tea" - }, - { - "label": "Tea & Coffee", - "value": "Tea & Coffee" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_radio_mandatory_with_detail_answer_mandatory.json b/schemas/test/en/test_radio_mandatory_with_detail_answer_mandatory.json deleted file mode 100644 index 4b2aa6e797..0000000000 --- a/schemas/test/en/test_radio_mandatory_with_detail_answer_mandatory.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Radio Mandatory with Mandatory Detail Answer", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "radio", - "title": "Radio Mandatory with Detail Answer", - "blocks": [ - { - "type": "Question", - "id": "radio-mandatory", - "question": { - "type": "General", - "id": "radio-mandatory-question", - "title": "What is you favourite breakfast item?", - "answers": [ - { - "type": "Radio", - "id": "radio-mandatory-answer", - "mandatory": true, - "options": [ - { - "label": "Toast", - "value": "Toast" - }, - { - "label": "Other", - "description": "An answer is required.", - "value": "Other", - "detail_answer": { - "mandatory": true, - "id": "other-answer-mandatory", - "label": "Please specify other", - "type": "TextField" - } - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_radio_mandatory_with_detail_answer_mandatory_with_overridden_error.json b/schemas/test/en/test_radio_mandatory_with_detail_answer_mandatory_with_overridden_error.json deleted file mode 100644 index 8bc0c6329f..0000000000 --- a/schemas/test/en/test_radio_mandatory_with_detail_answer_mandatory_with_overridden_error.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Radio Mandatory with Mandatory Detail Answer Overridden Error", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "radio", - "title": "Radio Mandatory with Mandatory Detail Answer Overridden Error", - "blocks": [ - { - "type": "Question", - "id": "radio-mandatory", - "question": { - "type": "General", - "id": "radio-mandatory-question", - "title": "What is you favourite breakfast item?", - "answers": [ - { - "type": "Radio", - "id": "radio-mandatory-answer", - "mandatory": true, - "options": [ - { - "label": "Toast", - "value": "Toast" - }, - { - "label": "Other", - "description": "An answer is required.", - "value": "Other", - "detail_answer": { - "mandatory": true, - "id": "other-answer-mandatory", - "label": "Please specify other", - "type": "TextField", - "validation": { - "messages": { - "MANDATORY_TEXTFIELD": "Test error message is overridden" - } - } - } - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_radio_mandatory_with_detail_answer_optional.json b/schemas/test/en/test_radio_mandatory_with_detail_answer_optional.json deleted file mode 100644 index 02a190b478..0000000000 --- a/schemas/test/en/test_radio_mandatory_with_detail_answer_optional.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Radio Mandatory with Optional Detail Answer", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "radio", - "title": "Radio Mandatory with Optional Detail Answer", - "blocks": [ - { - "type": "Question", - "id": "radio-mandatory", - "question": { - "type": "General", - "id": "radio-mandatory-question", - "title": "What is you favourite breakfast item?", - "answers": [ - { - "type": "Radio", - "id": "radio-mandatory-answer", - "mandatory": false, - "options": [ - { - "label": "Toast", - "value": "Toast" - }, - { - "label": "Other", - "description": "An answer is required.", - "value": "Other", - "detail_answer": { - "mandatory": false, - "id": "other-answer-mandatory", - "label": "Please specify other", - "type": "TextField" - } - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_radio_mandatory_with_overridden_error.json b/schemas/test/en/test_radio_mandatory_with_overridden_error.json deleted file mode 100644 index 739d64fc97..0000000000 --- a/schemas/test/en/test_radio_mandatory_with_overridden_error.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Radio Mandatory with Overridden Error", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "radio", - "title": "Radio Mandatory with Overridden Error", - "blocks": [ - { - "type": "Question", - "id": "radio-mandatory", - "question": { - "type": "General", - "id": "radio-mandatory-question", - "title": "What is you favourite breakfast beverage?", - "answers": [ - { - "type": "Radio", - "id": "radio-mandatory-answer", - "mandatory": true, - "options": [ - { - "label": "Coffee", - "value": "Coffee" - }, - { - "label": "Tea", - "value": "Tea" - } - ], - "validation": { - "messages": { - "MANDATORY_RADIO": "Test error message is overridden" - } - } - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_radio_optional.json b/schemas/test/en/test_radio_optional.json deleted file mode 100644 index 2e50644e9b..0000000000 --- a/schemas/test/en/test_radio_optional.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Radio Optional", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section-1", - "groups": [ - { - "id": "radio", - "title": "Radio Optional", - "blocks": [ - { - "type": "Question", - "id": "radio-non-mandatory", - "question": { - "type": "General", - "id": "radio-non-mandatory-question", - "title": "What is you favourite breakfast beverage?", - "answers": [ - { - "type": "Radio", - "id": "radio-non-mandatory-answer", - "mandatory": false, - "options": [ - { - "label": "Coffee", - "value": "Coffee" - }, - { - "label": "Tea", - "value": "Tea" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_radio_optional_with_detail_answer_mandatory.json b/schemas/test/en/test_radio_optional_with_detail_answer_mandatory.json deleted file mode 100644 index 179f552dd5..0000000000 --- a/schemas/test/en/test_radio_optional_with_detail_answer_mandatory.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Radio Optional with Mandatory Detail Answer", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "radio", - "title": "Radio Optional with Detail Answer", - "blocks": [ - { - "type": "Question", - "id": "radio-non-mandatory", - "question": { - "type": "General", - "id": "radio-non-mandatory-question", - "title": "What is you favourite breakfast item?", - "answers": [ - { - "type": "Radio", - "id": "radio-non-mandatory-answer", - "mandatory": true, - "options": [ - { - "label": "Toast", - "value": "Toast" - }, - { - "label": "Other", - "description": "This is mandatory.", - "value": "Other", - "detail_answer": { - "mandatory": false, - "id": "other-answer-non-mandatory", - "label": "Please specify other", - "type": "TextField" - } - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_radio_optional_with_detail_answer_mandatory_with_overridden_error.json b/schemas/test/en/test_radio_optional_with_detail_answer_mandatory_with_overridden_error.json deleted file mode 100644 index e9097bbab0..0000000000 --- a/schemas/test/en/test_radio_optional_with_detail_answer_mandatory_with_overridden_error.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.2", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Radio Optional with Mandatory Detail Answer Overridden Error", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "radio", - "title": "Radio Optional with Mandatory Detail Answer Overridden Error", - "blocks": [ - { - "type": "Question", - "id": "radio-non-mandatory", - "question": { - "type": "General", - "id": "radio-non-mandatory-question", - "title": "What do you prefer for breakfast?", - "answers": [ - { - "type": "Radio", - "id": "radio-non-mandatory-answer", - "mandatory": true, - "options": [ - { - "label": "Toast", - "value": "Toast" - }, - { - "label": "Other", - "description": "This is mandatory.", - "value": "Other", - "detail_answer": { - "mandatory": true, - "id": "other-answer-non-mandatory", - "label": "Please specify other", - "type": "TextField", - "validation": { - "messages": { - "MANDATORY_TEXTFIELD": "Test error message is overridden" - } - } - } - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_radio_optional_with_detail_answer_optional.json b/schemas/test/en/test_radio_optional_with_detail_answer_optional.json deleted file mode 100644 index a31dc2488f..0000000000 --- a/schemas/test/en/test_radio_optional_with_detail_answer_optional.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Radio Optional with Optional Detail Answer", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "radio", - "title": "Radio Optional with Optional Detail Answer", - "blocks": [ - { - "type": "Question", - "id": "radio-non-mandatory", - "question": { - "type": "General", - "id": "radio-non-mandatory-question", - "title": "What do you prefer for breakfast?", - "answers": [ - { - "type": "Radio", - "id": "radio-non-mandatory-answer", - "mandatory": false, - "options": [ - { - "label": "Toast", - "value": "Toast" - }, - { - "label": "Other", - "description": "This is optional.", - "value": "Other", - "detail_answer": { - "mandatory": false, - "id": "other-answer-non-mandatory", - "label": "Please specify other", - "type": "TextField" - } - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_radio_voluntary.json b/schemas/test/en/test_radio_voluntary.json deleted file mode 100644 index 53a7bc5a49..0000000000 --- a/schemas/test/en/test_radio_voluntary.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Radio Voluntary", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section-1", - "groups": [ - { - "id": "radio", - "title": "Radio Voluntary", - "blocks": [ - { - "type": "Question", - "id": "radio-voluntary-true", - "question": { - "type": "General", - "id": "radio-voluntary-true-question", - "title": "What is your favourite drink?", - "answers": [ - { - "type": "Radio", - "id": "radio-voluntary-true-answer", - "mandatory": false, - "voluntary": true, - "options": [ - { - "label": "Coffee", - "value": "Coffee" - }, - { - "label": "Tea", - "value": "Tea" - } - ] - } - ] - } - }, - { - "type": "Question", - "id": "radio-voluntary-false", - "question": { - "type": "General", - "id": "radio-voluntary-false-question", - "title": "What is your favourite food?", - "answers": [ - { - "type": "Radio", - "id": "radio-voluntary-false-answer", - "mandatory": false, - "voluntary": false, - "options": [ - { - "label": "Ice cream", - "value": "Ice cream" - }, - { - "label": "Hamburger", - "value": "Hamburger" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_radio_voluntary_with_repeating_sections.json b/schemas/test/en/test_radio_voluntary_with_repeating_sections.json deleted file mode 100644 index 9cd538c0f2..0000000000 --- a/schemas/test/en/test_radio_voluntary_with_repeating_sections.json +++ /dev/null @@ -1,245 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Repeating Section With Voluntary Radio", - "theme": "default", - "description": "A questionnaire to test clear voluntary radio fields functionality in repeating section", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section", - "title": "Household", - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone live here?", - "answers": [ - { - "id": "anyone-lives-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "personal-details-section", - "title": "Personal Details", - "summary": { "show_on_completion": true }, - "repeat": { - "for_list": "people", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "groups": [ - { - "id": "radio", - "title": "Radio Voluntary", - "blocks": [ - { - "type": "Question", - "id": "radio-voluntary", - "question": { - "type": "General", - "id": "radio-voluntary-question", - "title": "What is your favourite drink?", - "answers": [ - { - "type": "Radio", - "id": "radio-voluntary-answer", - "mandatory": false, - "voluntary": true, - "options": [ - { - "label": "Coffee", - "value": "Coffee" - }, - { - "label": "Tea", - "value": "Tea" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_relationships.json b/schemas/test/en/test_relationships.json deleted file mode 100644 index 9054e842a7..0000000000 --- a/schemas/test/en/test_relationships.json +++ /dev/null @@ -1,934 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Relationships", - "theme": "default", - "description": "A questionnaire to test capturing of relationships.", - "messages": {}, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "summary": { - "show_on_completion": true, - "items": [ - { - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders", - "for_list": "people", - "title": "Household members", - "type": "List" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "Relationships", - "blocks": [ - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live at 1 Pleasant Lane?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person who isn’t you?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "People who live here", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "type": "RelationshipCollector", - "id": "relationships", - "title": "This will iterate over the people list, capturing the one way relationships.", - "for_list": "people", - "question": { - "id": "relationship-question", - "type": "General", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their ", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "answers": [ - { - "id": "relationship-answer", - "mandatory": true, - "type": "Relationship", - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} ", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "options": [ - { - "label": "Husband or Wife", - "value": "Husband or Wife", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their husband or wife", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} husband or wife", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - { - "label": "Legally registered civil partner", - "value": "Legally registered civil partner", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their legally registered civil partner", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} legally registered civil partner", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - { - "label": "Son or daughter", - "value": "Son or daughter", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their son or daughter", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} son or daughter", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - { - "label": "Brother or sister", - "value": "Brother or sister", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their brother or sister", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} brother or sister", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "description": "Including half brother or half sister" - } - ] - } - ] - }, - "skip_conditions": { - "when": { - "<": [ - { - "source": "list", - "identifier": "people", - "selector": "count" - }, - 2 - ] - } - } - }, - { - "id": "relationship-interstitial", - "content": { - "title": "Relationship section", - "contents": [ - { - "description": "You have successfully completed the relationship section." - } - ] - }, - "type": "Interstitial", - "skip_conditions": { - "when": { - "<": [ - { - "source": "list", - "identifier": "people", - "selector": "count" - }, - 2 - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_relationships_primary.json b/schemas/test/en/test_relationships_primary.json deleted file mode 100644 index 2fe0d5149f..0000000000 --- a/schemas/test/en/test_relationships_primary.json +++ /dev/null @@ -1,1364 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test PrimaryPersonListCollector", - "theme": "default", - "description": "A questionnaire to test Primary Person ListCollector", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": {} - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "id": "group", - "title": "Primary Person", - "blocks": [ - { - "id": "primary-person-list-collector", - "type": "PrimaryPersonListCollector", - "for_list": "people", - "add_or_edit_block": { - "id": "add-or-edit-primary-person", - "type": "PrimaryPersonListAddOrEditQuestion", - "question": { - "id": "primary-person-add-or-edit-question", - "type": "General", - "title": "What is your name", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "question": { - "id": "primary-confirmation-question", - "type": "General", - "title": "Do you live here?", - "answers": [ - { - "id": "you-live-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": { - "text": "Change details for {first_name} {last_name}", - "placeholders": [ - { - "placeholder": "first_name", - "value": { - "source": "answers", - "identifier": "first-name" - } - }, - { - "placeholder": "last_name", - "value": { - "source": "answers", - "identifier": "last-name" - } - } - ] - }, - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "type": "RelationshipCollector", - "id": "relationships", - "title": "This will iterate over the people list, capturing the one way relationships.", - "for_list": "people", - "question_variants": [ - { - "question": { - "id": "relationship-question", - "type": "General", - "title": { - "text": "{second_person_name} is your ", - "placeholders": [ - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "answers": [ - { - "id": "relationship-answer", - "mandatory": true, - "type": "Relationship", - "playback": { - "text": "{second_person_name} is your ", - "placeholders": [ - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "options": [ - { - "label": "Husband or Wife", - "value": "Husband or Wife", - "title": { - "text": "{second_person_name} is your husband or wife", - "placeholders": [ - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is your husband or wife", - "placeholders": [ - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - { - "label": "Legally registered civil partner", - "value": "Legally registered civil partner", - "title": { - "text": "{second_person_name} is your legally registered civil partner", - "placeholders": [ - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is your legally registered civil partner", - "placeholders": [ - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - { - "label": "Son or daughter", - "value": "Son or daughter", - "title": { - "text": "{second_person_name} is your son or daughter", - "placeholders": [ - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is your son or daughter", - "placeholders": [ - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - { - "label": "Brother or sister", - "value": "Brother or sister", - "title": { - "text": "{second_person_name} is your brother or sister", - "placeholders": [ - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is your brother or sister", - "placeholders": [ - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - } - } - ] - } - ] - }, - "when": { - "==": [ - { - "source": "list", - "identifier": "people", - "selector": "primary_person" - }, - { - "source": "location", - "identifier": "list_item_id" - } - ] - } - }, - { - "question": { - "id": "relationship-question", - "type": "General", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their ", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "answers": [ - { - "id": "relationship-answer", - "mandatory": true, - "type": "Relationship", - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} ", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "options": [ - { - "label": "Husband or Wife", - "value": "Husband or Wife", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their husband or wife", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} husband or wife", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - { - "label": "Legally registered civil partner", - "value": "Legally registered civil partner", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their legally registered civil partner", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} legally registered civil partner", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - { - "label": "Son or daughter", - "value": "Son or daughter", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their son or daughter", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} son or daughter", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - { - "label": "Brother or sister", - "value": "Brother or sister", - "title": { - "text": "Thinking of {first_person_name}, {second_person_name} is their brother or sister", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} brother or sister", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - } - } - ] - } - ] - }, - "when": { - "!=": [ - { - "identifier": "people", - "source": "list", - "selector": "primary_person" - }, - { - "source": "location", - "identifier": "list_item_id" - } - ] - } - } - ], - "skip_conditions": { - "when": { - "<": [ - { - "identifier": "people", - "source": "list", - "selector": "count" - }, - 2 - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_relationships_unrelated.json b/schemas/test/en/test_relationships_unrelated.json deleted file mode 100644 index ea03d61774..0000000000 --- a/schemas/test/en/test_relationships_unrelated.json +++ /dev/null @@ -1,855 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Relationships Unrelated Question", - "theme": "default", - "description": "A questionnaire to test capturing of relationships.", - "messages": {}, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "summary": { - "show_on_completion": true, - "items": [ - { - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders", - "for_list": "people", - "title": "Household members", - "type": "List" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "Relationships", - "blocks": [ - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live at 1 Pleasant Lane?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person who isn’t you?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "People who live here", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "type": "RelationshipCollector", - "id": "relationships", - "title": "This will iterate over the people list, capturing the one way relationships.", - "for_list": "people", - "question": { - "id": "relationship-question", - "type": "General", - "title": { - "text": "Thinking about {first_person_name}, {second_person_name} is their ", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "answers": [ - { - "id": "relationship-answer", - "mandatory": true, - "type": "Relationship", - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} ", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "options": [ - { - "label": "Husband or Wife", - "value": "Husband or Wife", - "title": { - "text": "Thinking about {first_person_name}, {second_person_name} is their husband or wife", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is {first_person_name_possessive} husband or wife", - "placeholders": [ - { - "placeholder": "first_person_name_possessive", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - }, - { - "transform": "format_possessive", - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - { - "label": "Unrelated", - "value": "Unrelated", - "title": { - "text": "Thinking about {first_person_name}, {second_person_name} is unrelated to {first_person_name}", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "playback": { - "text": "{second_person_name} is unrelated to {first_person_name}", - "placeholders": [ - { - "placeholder": "first_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - }, - { - "placeholder": "second_person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "to_list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ] - }, - "description": "Including half brother or half sister" - } - ] - } - ] - }, - "skip_conditions": { - "when": { - "<": [ - { - "identifier": "people", - "source": "list", - "selector": "count" - }, - 2 - ] - } - }, - "unrelated_block": { - "type": "UnrelatedQuestion", - "id": "related-to-anyone-else", - "page_title": "How person {list_item_position} is related to anyone else", - "title": "Related to anyone", - "list_summary": { - "for_list": "people", - "summary": { - "item_title": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ], - "text": "{person_name}" - } - } - }, - "question_variants": [ - { - "question": { - "id": "related-to-anyone-else-question", - "type": "General", - "title": "Are any of these people related to you?", - "guidance": { - "contents": [ - { - "description": "Remember to include partners, step-parents, and stepchildren as related" - } - ] - }, - "answers": [ - { - "id": "related-to-anyone-else-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveUnrelatedRelationships" - } - }, - { - "label": "No, none of these people are related to me", - "value": "No, none of these people are related to me", - "action": { - "type": "AddUnrelatedRelationships" - } - } - ] - } - ] - }, - "when": { - "==": [ - { - "identifier": "list_item_id", - "source": "location" - }, - { - "source": "list", - "identifier": "people", - "selector": "first" - } - ] - } - }, - { - "question": { - "id": "related-to-anyone-else-question", - "type": "General", - "title": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ], - "text": "Are any of these people related to {person_name}?" - }, - "guidance": { - "contents": [ - { - "description": "Remember to include partners, step-parents, and stepchildren as related" - } - ] - }, - "answers": [ - { - "id": "related-to-anyone-else-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveUnrelatedRelationships" - } - }, - { - "label": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - }, - { - "source": "answers", - "identifier": "last-name", - "list_item_selector": { - "source": "location", - "identifier": "list_item_id" - } - } - ], - "delimiter": " " - } - } - ] - } - ], - "text": "No, none of these people are related to {person_name}" - }, - "value": "No, none of these people are related to {person_name}", - "action": { - "type": "AddUnrelatedRelationships" - } - } - ] - } - ] - }, - "when": { - "!=": [ - { - "identifier": "list_item_id", - "source": "location" - }, - { - "source": "list", - "identifier": "people", - "selector": "first" - } - ] - } - } - ] - } - }, - { - "id": "relationship-interstitial", - "content": { - "title": "Relationship section", - "contents": [ - { - "description": "You have successfully completed the relationship section." - } - ] - }, - "type": "Interstitial", - "skip_conditions": { - "when": { - "<": [ - { - "source": "list", - "identifier": "people", - "selector": "count" - }, - 2 - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_repeating_section_summaries.json b/schemas/test/en/test_repeating_section_summaries.json deleted file mode 100644 index 3ba64c74a9..0000000000 --- a/schemas/test/en/test_repeating_section_summaries.json +++ /dev/null @@ -1,411 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Repeating Section Summaries", - "theme": "default", - "description": "A questionnaire to repeating section summary functionality", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section", - "title": "Household", - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "primary-person-list-collector", - "type": "PrimaryPersonListCollector", - "for_list": "people", - "add_or_edit_block": { - "id": "add-or-edit-primary-person", - "type": "PrimaryPersonListAddOrEditQuestion", - "question": { - "id": "primary-person-add-or-edit-question", - "type": "General", - "title": "What is your name?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "question": { - "id": "primary-confirmation-question", - "type": "General", - "title": "Do you live here?", - "answers": [ - { - "id": "you-live-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "personal-details-section", - "title": "Personal Details", - "summary": { - "show_on_completion": true - }, - "repeat": { - "for_list": "people", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "groups": [ - { - "id": "personal-details-group", - "title": "Personal Details", - "blocks": [ - { - "id": "proxy", - "question": { - "answers": [ - { - "default": "Yes", - "id": "proxy-answer", - "mandatory": false, - "options": [ - { - "label": "No, I’m answering for myself", - "value": "No, I’m answering for myself" - }, - { - "label": "Yes", - "value": "Yes" - } - ], - "type": "Radio" - } - ], - "id": "proxy-question", - "title": "Are you answering the questions on behalf of someone else?", - "type": "General" - }, - "type": "Question" - }, - { - "id": "date-of-birth", - "question_variants": [ - { - "question": { - "answers": [ - { - "id": "date-of-birth-answer", - "mandatory": true, - "maximum": { - "value": "now" - }, - "minimum": { - "offset_by": { - "years": -115 - }, - "value": "2019-10-13" - }, - "type": "Date" - } - ], - "guidance": { - "contents": [ - { - "description": "For example 31 12 1970" - } - ] - }, - "id": "date-of-birth-question", - "title": "What is your date of birth?", - "type": "General" - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "proxy-answer" - }, - "No, I’m answering for myself" - ] - } - }, - { - "question": { - "answers": [ - { - "id": "date-of-birth-answer", - "mandatory": true, - "maximum": { - "value": "now" - }, - "type": "Date" - } - ], - "guidance": { - "contents": [ - { - "description": "For example 31 12 1970" - } - ] - }, - "id": "date-of-birth-question", - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "What is {person_name_possessive} date of birth?" - }, - "type": "General" - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "proxy-answer" - }, - "Yes" - ] - } - } - ], - "type": "Question" - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_repeating_sections_with_hub_and_spoke.json b/schemas/test/en/test_repeating_sections_with_hub_and_spoke.json deleted file mode 100644 index 3d3e74cb38..0000000000 --- a/schemas/test/en/test_repeating_sections_with_hub_and_spoke.json +++ /dev/null @@ -1,1312 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Hub & Spoke", - "theme": "default", - "description": "A questionnaire to demo hub and spoke functionality", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": "Household members", - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - }, - { - "type": "List", - "for_list": "visitor", - "title": "Visitors", - "add_link_text": "Add a visitor", - "empty_list_text": "There are no visitors" - } - ] - }, - "id": "section", - "title": "Household", - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "primary-person-list-collector", - "type": "PrimaryPersonListCollector", - "for_list": "people", - "add_or_edit_block": { - "id": "add-or-edit-primary-person", - "type": "PrimaryPersonListAddOrEditQuestion", - "question": { - "id": "primary-person-add-or-edit-question", - "type": "General", - "title": "What is your name?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "question": { - "id": "primary-confirmation-question", - "type": "General", - "title": "Do you live here?", - "answers": [ - { - "id": "you-live-here", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - }, - { - "id": "extra-list-group", - "title": "Another List", - "blocks": [ - { - "id": "next-interstitial", - "content": { - "title": "Another list", - "contents": [ - { - "description": "You have added some people to the ‘people’ list. Next we’ll test another list collector adding to the same list. This should still have the same list of people." - } - ] - }, - "type": "Interstitial" - }, - { - "id": "another-list-collector-block", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "another-confirmation-question", - "type": "General", - "title": "This list collector will add to the same ‘people’ list. Add someone else?", - "answers": [ - { - "id": "another-anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "another-add-person", - "type": "ListAddQuestion", - "question": { - "id": "another-add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "another-edit-person", - "type": "ListEditQuestion", - "question": { - "id": "another-edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "another-remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "another-remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "another-remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - }, - { - "id": "visitors-list-group", - "title": "Visitors List", - "blocks": [ - { - "id": "visitors-block", - "type": "ListCollector", - "for_list": "visitor", - "question": { - "id": "visitors-confirmation-question", - "type": "General", - "title": "This is the visitors list collector. Add a visitor?", - "answers": [ - { - "id": "visitors-anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "visitors-add-person", - "type": "ListAddQuestion", - "question": { - "id": "visitors-add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "visitor-first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "visitor-last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "visitors-edit-person", - "type": "ListEditQuestion", - "question": { - "id": "visitors-edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "visitor-first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "visitor-last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "visitors-remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "visitors-remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "visitors-remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household visitors", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "visitor-first-name" - }, - { - "source": "answers", - "identifier": "visitor-last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "personal-details-section", - "title": "Personal Details", - "summary": { - "show_on_completion": true - }, - "repeat": { - "for_list": "people", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "groups": [ - { - "id": "personal-details-group", - "title": "Personal Details", - "blocks": [ - { - "id": "proxy", - "question": { - "answers": [ - { - "default": "Yes", - "id": "proxy-answer", - "mandatory": false, - "options": [ - { - "label": "No, I’m answering for myself", - "value": "No, I’m answering for myself" - }, - { - "label": "Yes", - "value": "Yes" - } - ], - "type": "Radio" - } - ], - "id": "proxy-question", - "title": "Are you answering the questions on behalf of someone else?", - "type": "General" - }, - "type": "Question" - }, - { - "id": "date-of-birth", - "question_variants": [ - { - "question": { - "answers": [ - { - "id": "date-of-birth-answer", - "mandatory": true, - "maximum": { - "value": "now" - }, - "minimum": { - "offset_by": { - "years": -115 - }, - "value": "2019-10-13" - }, - "type": "Date" - } - ], - "guidance": { - "contents": [ - { - "description": "For example 31 12 1970" - } - ] - }, - "id": "date-of-birth-question", - "title": "What is your date of birth?", - "type": "General" - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "proxy-answer" - }, - "No, I’m answering for myself" - ] - } - }, - { - "question": { - "answers": [ - { - "id": "date-of-birth-answer", - "mandatory": true, - "maximum": { - "value": "now" - }, - "minimum": { - "offset_by": { - "years": -115 - }, - "value": "2019-10-13" - }, - "type": "Date" - } - ], - "guidance": { - "contents": [ - { - "description": "For example 31 12 1970" - } - ] - }, - "id": "date-of-birth-question", - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "What is {person_name_possessive} date of birth?" - }, - "type": "General" - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "proxy-answer" - }, - "Yes" - ] - } - } - ], - "type": "Question" - }, - { - "id": "confirm-dob", - "question_variants": [ - { - "question": { - "answers": [ - { - "id": "confirm-date-of-birth-answer", - "mandatory": true, - "options": [ - { - "label": { - "placeholders": [ - { - "placeholder": "age", - "transforms": [ - { - "arguments": { - "first_date": { - "identifier": "date-of-birth-answer", - "source": "answers" - }, - "second_date": { - "value": "now" - } - }, - "transform": "calculate_date_difference" - } - ] - } - ], - "text": "Yes, I am {age} old" - }, - "value": "Yes, I am {age} old" - }, - { - "label": "No, I need to change my date of birth", - "value": "No, I need to change my date of birth" - } - ], - "type": "Radio" - } - ], - "id": "confirm-date-of-birth", - "title": { - "placeholders": [ - { - "placeholder": "age", - "transforms": [ - { - "arguments": { - "first_date": { - "identifier": "date-of-birth-answer", - "source": "answers" - }, - "second_date": { - "value": "now" - } - }, - "transform": "calculate_date_difference" - } - ] - } - ], - "text": "You are {age} old. Is this correct?" - }, - "type": "General" - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "proxy-answer" - }, - "No, I’m answering for myself" - ] - } - }, - { - "question": { - "answers": [ - { - "id": "confirm-date-of-birth-answer", - "mandatory": true, - "options": [ - { - "label": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - }, - { - "placeholder": "age", - "transforms": [ - { - "arguments": { - "first_date": { - "identifier": "date-of-birth-answer", - "source": "answers" - }, - "second_date": { - "value": "now" - } - }, - "transform": "calculate_date_difference" - } - ] - } - ], - "text": "Yes, {person_name} is {age} old" - }, - "value": "Yes, {person_name} is {age} old" - }, - { - "label": "No, I need to change their date of birth", - "value": "No, I need to change their date of birth" - } - ], - "type": "Radio" - } - ], - "id": "confirm-date-of-birth", - "title": { - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - }, - { - "placeholder": "age", - "transforms": [ - { - "arguments": { - "first_date": { - "identifier": "date-of-birth-answer", - "source": "answers" - }, - "second_date": { - "value": "now" - } - }, - "transform": "calculate_date_difference" - } - ] - } - ], - "text": "{person_name} is {age} old. Is this correct?" - }, - "type": "General" - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "proxy-answer" - }, - "Yes" - ] - } - } - ], - "routing_rules": [ - { - "block": "date-of-birth", - "when": { - "==": [ - { - "source": "answers", - "identifier": "confirm-date-of-birth-answer" - }, - "No, I need to change my date of birth" - ] - } - }, - { - "block": "date-of-birth", - "when": { - "==": [ - { - "source": "answers", - "identifier": "confirm-date-of-birth-answer" - }, - "No, I need to change their date of birth" - ] - } - }, - { - "block": "sex" - } - ], - "type": "ConfirmationQuestion" - }, - { - "id": "sex", - "question_variants": [ - { - "question": { - "answers": [ - { - "id": "sex-answer", - "mandatory": false, - "options": [ - { - "label": "Female", - "value": "Female" - }, - { - "label": "Male", - "value": "Male" - } - ], - "type": "Radio" - } - ], - "guidance": { - "contents": [ - { - "description": "A question about gender will follow" - } - ] - }, - "id": "sex-question", - "title": "What is your sex?", - "type": "General" - }, - "when": { - "and": [ - { - "==": [ - { - "source": "answers", - "identifier": "proxy-answer" - }, - "No, I’m answering for myself" - ] - }, - { - "<=": [ - { - "date": ["now", { "years": -16 }] - }, - { - "date": [ - { - "source": "answers", - "identifier": "date-of-birth-answer" - } - ] - } - ] - } - ] - } - }, - { - "question": { - "answers": [ - { - "id": "sex-answer", - "mandatory": false, - "options": [ - { - "label": "Female", - "value": "Female" - }, - { - "label": "Male", - "value": "Male" - } - ], - "type": "Radio" - } - ], - "guidance": { - "contents": [ - { - "description": "A question about gender will follow" - } - ] - }, - "id": "sex-question", - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "What is {person_name_possessive} sex?" - }, - "type": "General" - }, - "when": { - "and": [ - { - "==": [ - { - "source": "answers", - "identifier": "proxy-answer" - }, - "Yes" - ] - }, - { - "<=": [ - { - "date": ["now", { "years": -16 }] - }, - { - "date": [{ "source": "answers", "identifier": "date-of-birth-answer" }] - } - ] - } - ] - } - }, - { - "question": { - "answers": [ - { - "id": "sex-answer", - "mandatory": false, - "options": [ - { - "label": "Female", - "value": "Female" - }, - { - "label": "Male", - "value": "Male" - } - ], - "type": "Radio" - } - ], - "id": "sex-question", - "title": "What is your sex?", - "type": "General" - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "proxy-answer" - }, - "No, I’m answering for myself" - ] - } - }, - { - "question": { - "answers": [ - { - "id": "sex-answer", - "mandatory": false, - "options": [ - { - "label": "Female", - "value": "Female" - }, - { - "label": "Male", - "value": "Male" - } - ], - "type": "Radio" - } - ], - "id": "sex-question", - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "What is {person_name_possessive} sex?" - }, - "type": "General" - }, - "when": { - "==": [ - { - "source": "answers", - "identifier": "proxy-answer" - }, - "Yes" - ] - } - } - ], - "type": "Question" - } - ] - } - ] - }, - { - "id": "visitors-section", - "title": "Visitors", - "repeat": { - "for_list": "visitor", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "visitor-first-name" - }, - { - "source": "answers", - "identifier": "visitor-last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "groups": [ - { - "id": "visitors-group", - "title": "Visitors", - "blocks": [ - { - "id": "visitors-date-of-birth", - "type": "Question", - "question": { - "answers": [ - { - "id": "visitors-date-of-birth-answer", - "mandatory": true, - "maximum": { - "value": "now" - }, - "minimum": { - "offset_by": { - "years": -115 - }, - "value": "2019-10-13" - }, - "type": "Date" - } - ], - "guidance": { - "contents": [ - { - "description": "For example 31 12 1970" - } - ] - }, - "id": "visitors-date-of-birth-question", - "title": { - "placeholders": [ - { - "placeholder": "person_name_possessive", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "visitor-first-name" - }, - { - "source": "answers", - "identifier": "visitor-last-name" - } - ] - }, - "transform": "concatenate_list" - }, - { - "arguments": { - "string_to_format": { - "source": "previous_transform" - } - }, - "transform": "format_possessive" - } - ] - } - ], - "text": "What is {person_name_possessive} date of birth?" - }, - "type": "General" - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_and.json b/schemas/test/en/test_routing_and.json deleted file mode 100644 index 89f0ea82b3..0000000000 --- a/schemas/test/en/test_routing_and.json +++ /dev/null @@ -1,180 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing And", - "theme": "default", - "description": "A test survey for routing based on the AND operator", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "number-question-1", - "question": { - "guidance": { - "contents": [ - { - "description": "Enter 123 here AND 321 on the next question to route to the “correct” page otherwise you will be routed to the “incorrect” page" - } - ] - }, - "answers": [ - { - "id": "answer-1", - "mandatory": true, - "type": "Number", - "label": "Enter 123" - } - ], - "id": "question-1", - "title": "Enter the number 123", - "type": "General" - } - }, - { - "type": "Question", - "id": "number-question-2", - "question": { - "answers": [ - { - "id": "answer-2", - "mandatory": true, - "type": "Number", - "label": "Enter 321" - } - ], - "id": "question-2", - "title": "Enter the number 321", - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - "and": [ - { - "==": [ - { - "source": "answers", - "identifier": "answer-1" - }, - 123 - ] - }, - { - "==": [ - { - "source": "answers", - "identifier": "answer-2" - }, - 321 - ] - } - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "You did not enter the correct answers", - "contents": [ - { - "description": { - "text": "You were asked to enter 123 and 321 but you actually entered {answer_1} and {answer_2}.", - "placeholders": [ - { - "placeholder": "answer_1", - "value": { - "source": "answers", - "identifier": "answer-1" - } - }, - { - "placeholder": "answer_2", - "value": { - "source": "answers", - "identifier": "answer-2" - } - } - ] - } - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "Correct", - "contents": [ - { - "description": { - "text": "You were asked to enter 123 and 321 and you entered {answer_1} and {answer_2}.", - "placeholders": [ - { - "placeholder": "answer_1", - "value": { - "source": "answers", - "identifier": "answer-1" - } - }, - { - "placeholder": "answer_2", - "value": { - "source": "answers", - "identifier": "answer-2" - } - } - ] - } - } - ] - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_and_skipping_section_dependencies.json b/schemas/test/en/test_routing_and_skipping_section_dependencies.json deleted file mode 100644 index 0987ace23f..0000000000 --- a/schemas/test/en/test_routing_and_skipping_section_dependencies.json +++ /dev/null @@ -1,707 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Routing and Skipping Section Dependencies", - "theme": "default", - "description": "A questionnaire to test routing and skipping rules, when the rule references a different section to its current section", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "title": "Skip question", - "summary": { "show_on_completion": true }, - "id": "skip-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "skip-age", - "question": { - "answers": [ - { - "id": "skip-age-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "skip-age-question", - "title": "Do you want to skip all age questions in all sections", - "type": "General" - } - }, - { - "type": "Question", - "id": "skip-household-section", - "question": { - "id": "skip-household-section-question", - "title": "Do you want to skip the question about skipping the household summary section?", - "type": "General", - "answers": [ - { - "id": "skip-household-section-answer", - "label": "It will remove the enable section question from the routing path", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ] - } - }, - { - "type": "Question", - "id": "enable-section", - "question": { - "id": "enable-section-question", - "title": "Do you want to enable the household summary section?", - "type": "General", - "answers": [ - { - "id": "enable-section-answer", - "label": "Depending on the answer it will enable or disable the household summary section", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ] - }, - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "skip-household-section-answer", - "source": "answers" - }, - "Yes" - ] - } - } - } - ], - "id": "skip-age-group" - } - ] - }, - { - "title": "Skip question confirmation", - "summary": { "show_on_completion": true }, - "id": "skip-confirmation-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "security", - "question": { - "answers": [ - { - "id": "security-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "security-question", - "title": "You understand that your personal details will be held securely and not shared with anyone?", - "type": "General" - }, - "routing_rules": [ - { - "block": "skip-confirmation", - "when": { - "==": [ - "Yes", - { - "source": "answers", - "identifier": "skip-age-answer" - } - ] - } - }, - { - "section": "End" - } - ] - }, - { - "type": "Question", - "id": "skip-confirmation", - "question": { - "answers": [ - { - "id": "skip-confirmation-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "skip-confirmation-question", - "title": "Are you sure you want to skip all age questions in all sections?", - "type": "General" - } - } - ], - "id": "skip-confirmation-group" - } - ] - }, - { - "title": "Primary Person", - "summary": { "show_on_completion": true }, - "id": "primary-person", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "name-block", - "question": { - "answers": [ - { - "label": "Full Name", - "id": "name-answer", - "mandatory": false, - "type": "TextField" - } - ], - "id": "name-question", - "title": "What is your name?", - "type": "General" - } - }, - { - "type": "Question", - "id": "age", - "question": { - "answers": [ - { - "label": "Age in years", - "id": "age-answer", - "mandatory": false, - "type": "Number" - } - ], - "id": "age-question", - "title": "What is your age?", - "type": "General" - }, - "skip_conditions": { - "when": { - "and": [ - { - "==": [ - { - "source": "answers", - "identifier": "skip-age-answer" - }, - "Yes" - ] - }, - { - "!=": [ - { - "source": "answers", - "identifier": "skip-confirmation-answer" - }, - "No" - ] - } - ] - } - } - } - ], - "id": "primary-person-group", - "title": "Primary Person" - }, - { - "blocks": [ - { - "type": "Question", - "id": "reason-no-confirmation", - "question": { - "answers": [ - { - "id": "reason-no-confirmation-answer", - "mandatory": false, - "options": [ - { - "label": "I did not visit section 2, so confirmation was not needed", - "value": "I did not visit section 2, so confirmation was not needed" - }, - { - "label": "I did, but it was removed from the path as I changed my answer to No on the skip question", - "value": "I did, but it was removed from the path as I changed my answer to No on the skip question" - } - ], - "type": "Radio" - } - ], - "id": "reason-no-confirmation-question", - "title": "Why did you not answer the age skipping confirmation question?", - "type": "General" - } - } - ], - "id": "confirmation-group", - "title": "Confirmation Question", - "skip_conditions": { - "when": { - "or": [ - { - "==": [ - { - "source": "answers", - "identifier": "skip-confirmation-answer" - }, - "Yes" - ] - }, - { - "==": [ - { - "source": "answers", - "identifier": "skip-confirmation-answer" - }, - "No" - ] - } - ] - } - } - } - ] - }, - { - "enabled": { - "when": { - "==": [ - "Yes", - { - "source": "answers", - "identifier": "enable-section-answer" - } - ] - } - }, - "id": "household-section", - "title": "Household Summary", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": "Household members", - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "cancel_text": "Don’t need to add anyone else?", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "cancel_text": "Don’t need to change anything?", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "cancel_text": "Don’t need to remove this person?", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "warning": "All of the information about this person will be deleted", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "household-personal-details-section", - "title": "Personal Details", - "summary": { "show_on_completion": true }, - "repeat": { - "for_list": "people", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "groups": [ - { - "id": "personal-details-group", - "title": "Personal Details", - "blocks": [ - { - "id": "repeating-sex", - "question": { - "answers": [ - { - "id": "repeating-sex-answer", - "mandatory": false, - "options": [ - { - "label": "Male", - "value": "Male" - }, - { - "label": "Female", - "value": "Female" - } - ], - "type": "Radio" - } - ], - "id": "repeating-sex-question", - "title": "What sex is this person?", - "type": "General" - }, - "type": "Question" - }, - { - "type": "Question", - "id": "repeating-age", - "question": { - "answers": [ - { - "label": "Age in years", - "id": "repeating-age-answer", - "mandatory": false, - "type": "Number" - } - ], - "id": "repeating-age-question", - "title": "What age is this person?", - "type": "General" - }, - "skip_conditions": { - "when": { - "and": [ - { - "==": [ - { - "source": "answers", - "identifier": "skip-age-answer" - }, - "Yes" - ] - }, - { - "!=": [ - { - "source": "answers", - "identifier": "skip-confirmation-answer" - }, - "No" - ] - } - ] - } - } - }, - { - "id": "repeating-is-dependent", - "question": { - "answers": [ - { - "id": "repeating-is-dependent-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - }, - { - "label": "Prefer not to say", - "value": "Prefer not to say" - } - ], - "type": "Radio" - } - ], - "id": "repeating-is-dependent-question", - "title": "Is this person dependent on you?", - "type": "General" - }, - "type": "Question" - }, - { - "id": "repeating-is-smoker", - "question": { - "answers": [ - { - "id": "repeating-is-smoker-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - }, - { - "label": "Prefer not to say", - "value": "Prefer not to say" - } - ], - "type": "Radio" - } - ], - "id": "repeating-is-smoker-question", - "title": "Is this person smoke or use nicotine products?", - "type": "General" - }, - "type": "Question", - "skip_conditions": { - "when": { - "or": [ - { - "==": [ - { - "source": "answers", - "identifier": "skip-age-answer" - }, - "Yes" - ] - }, - { - "<=": [ - { - "source": "answers", - "identifier": "repeating-age-answer" - }, - 18 - ] - } - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_and_skipping_section_dependencies_calculated_summary.json b/schemas/test/en/test_routing_and_skipping_section_dependencies_calculated_summary.json deleted file mode 100644 index adf631db12..0000000000 --- a/schemas/test/en/test_routing_and_skipping_section_dependencies_calculated_summary.json +++ /dev/null @@ -1,338 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Routing and Skipping Section Dependencies based on Calculated Summary", - "theme": "default", - "description": "A questionnaire to test routing and skipping rules, when the rule references a different section to its current section", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "title": "Calculated Summary Section", - "summary": { "show_on_completion": true }, - "id": "calculated-summary-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "first-question-block", - "question": { - "id": "first-question", - "title": "How much do you spend on the following items?", - "description": [ - "If the total is equal to £100 a new section will appear on the hub and if it is greater than or equal to £100 a dependent question will appear in the dependent question section" - ], - "type": "General", - "answers": [ - { - "id": "milk-answer", - "label": "Milk", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "eggs-answer", - "label": "Eggs", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "bread-answer", - "label": "Bread", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "cheese-answer", - "label": "Cheese", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "skip-butter-block", - "question": { - "type": "General", - "id": "skip-butter-block-question", - "title": "Skip optional question about butter so that it doesn’t appear in the Total?", - "answers": [ - { - "type": "Radio", - "id": "skip-butter-block-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "skip-butter-block-answer", - "source": "answers" - }, - "Yes" - ] - } - }, - "type": "Question", - "id": "butter-block", - "question": { - "id": "butter-question", - "title": "How much do you spend on butter?", - "type": "General", - "answers": [ - { - "id": "butter-answer", - "label": "Butter", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "currency-total-playback", - "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", - "calculation": { - "calculation_type": "sum", - "answers_to_calculate": ["milk-answer", "eggs-answer", "bread-answer", "cheese-answer", "butter-answer"], - "title": "Grand total of previous values" - } - } - ], - "id": "calculated-summary-group" - } - ] - }, - { - "title": "Dependent question Section", - "summary": { "show_on_completion": true }, - "id": "dependent-question-section", - "groups": [ - { - "blocks": [ - { - "skip_conditions": { - "when": { - ">=": [ - { - "source": "calculated_summary", - "identifier": "currency-total-playback" - }, - 10 - ] - } - }, - "type": "Question", - "id": "fruit", - "question": { - "answers": [ - { - "id": "fruit-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "fruit-question", - "title": "Do you like eating fruit", - "type": "General" - } - }, - { - "routing_rules": [ - { - "block": "second-question-block", - "when": { - ">=": [ - { - "source": "calculated_summary", - "identifier": "currency-total-playback" - }, - 100 - ] - } - }, - { - "section": "End" - } - ], - "type": "Question", - "id": "vegetables", - "question": { - "answers": [ - { - "id": "vegetables-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "vegetables-question", - "title": "Do you like eating vegetables", - "type": "General" - } - }, - { - "type": "Question", - "id": "second-question-block", - "question": { - "id": "second-question", - "title": "How much do you spend on the following items?", - "type": "General", - "answers": [ - { - "id": "apples-answer", - "label": "Apples", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "bananas-answer", - "label": "Bananas", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "oranges-answer", - "label": "Oranges", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "lemons-answer", - "label": "Lemons", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - } - ], - "id": "dependent-question-group" - } - ] - }, - { - "enabled": { - "when": { - "==": [ - 100, - { - "source": "calculated_summary", - "identifier": "currency-total-playback" - } - ] - } - }, - "title": "Dependent Enabled Section", - "summary": { "show_on_completion": true }, - "id": "dependent-enabled-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "desserts", - "question": { - "answers": [ - { - "id": "desserts-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "desserts-question", - "title": "Do you like eating desserts", - "type": "General" - } - } - ], - "id": "dependent-enabled-section-group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_and_skipping_section_dependencies_new_calculated_summary.json b/schemas/test/en/test_routing_and_skipping_section_dependencies_new_calculated_summary.json deleted file mode 100644 index 4de0f7aeb3..0000000000 --- a/schemas/test/en/test_routing_and_skipping_section_dependencies_new_calculated_summary.json +++ /dev/null @@ -1,360 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Routing and Skipping Section Dependencies based on Calculated Summary", - "theme": "default", - "description": "A questionnaire to test routing and skipping rules, when the rule references a different section to its current section", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "title": "Calculated Summary Section", - "summary": { "show_on_completion": true }, - "id": "calculated-summary-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "first-question-block", - "question": { - "id": "first-question", - "title": "How much do you spend on the following items?", - "description": [ - "If the total is equal to £100 a new section will appear on the hub and if it is less than or equal to £10 a dependent question will appear in the dependent question section" - ], - "type": "General", - "answers": [ - { - "id": "milk-answer", - "label": "Milk", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "eggs-answer", - "label": "Eggs", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "bread-answer", - "label": "Bread", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "cheese-answer", - "label": "Cheese", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "skip-butter-block", - "question": { - "type": "General", - "id": "skip-butter-block-question", - "title": "Skip optional question about butter so that it doesn’t appear in the Total?", - "answers": [ - { - "type": "Radio", - "id": "skip-butter-block-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "skip-butter-block-answer", - "source": "answers" - }, - "Yes" - ] - } - }, - "type": "Question", - "id": "butter-block", - "question": { - "id": "butter-question", - "title": "How much do you spend on butter?", - "type": "General", - "answers": [ - { - "id": "butter-answer", - "label": "Butter", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "currency-total-playback", - "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", - "calculation": { - "operation": { - "+": [ - { - "source": "answers", - "identifier": "milk-answer" - }, - { - "source": "answers", - "identifier": "eggs-answer" - }, - { - "source": "answers", - "identifier": "bread-answer" - }, - { - "source": "answers", - "identifier": "cheese-answer" - }, - { - "source": "answers", - "identifier": "butter-answer" - } - ] - }, - "title": "Grand total of previous values" - } - } - ], - "id": "calculated-summary-group" - } - ] - }, - { - "title": "Dependent question Section", - "summary": { "show_on_completion": true }, - "id": "dependent-question-section", - "groups": [ - { - "blocks": [ - { - "skip_conditions": { - "when": { - ">=": [ - { - "source": "calculated_summary", - "identifier": "currency-total-playback" - }, - 10 - ] - } - }, - "type": "Question", - "id": "fruit", - "question": { - "answers": [ - { - "id": "fruit-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "fruit-question", - "title": "Do you like eating fruit", - "type": "General" - } - }, - { - "routing_rules": [ - { - "block": "second-question-block", - "when": { - ">=": [ - { - "source": "calculated_summary", - "identifier": "currency-total-playback" - }, - 100 - ] - } - }, - { - "section": "End" - } - ], - "type": "Question", - "id": "vegetables", - "question": { - "answers": [ - { - "id": "vegetables-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "vegetables-question", - "title": "Do you like eating vegetables", - "type": "General" - } - }, - { - "type": "Question", - "id": "second-question-block", - "question": { - "id": "second-question", - "title": "How much do you spend on the following items?", - "type": "General", - "answers": [ - { - "id": "apples-answer", - "label": "Apples", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "bananas-answer", - "label": "Bananas", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "oranges-answer", - "label": "Oranges", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "lemons-answer", - "label": "Lemons", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - } - ], - "id": "dependent-question-group" - } - ] - }, - { - "enabled": { - "when": { - "==": [ - 100, - { - "source": "calculated_summary", - "identifier": "currency-total-playback" - } - ] - } - }, - "title": "Dependent Enabled Section", - "summary": { "show_on_completion": true }, - "id": "dependent-enabled-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "desserts", - "question": { - "answers": [ - { - "id": "desserts-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "desserts-question", - "title": "Do you like eating desserts", - "type": "General" - } - } - ], - "id": "dependent-enabled-section-group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_answer_comparison.json b/schemas/test/en/test_routing_answer_comparison.json deleted file mode 100644 index 9b89ca4491..0000000000 --- a/schemas/test/en/test_routing_answer_comparison.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Answer Comparisons", - "theme": "default", - "legal_basis": "StatisticsOfTradeAct", - "description": "A test survey for routing based comparison with answers", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "route-group", - "blocks": [ - { - "type": "Question", - "id": "route-comparison-1", - "question": { - "answers": [ - { - "id": "route-comparison-1-answer", - "label": "1st Number", - "mandatory": true, - "type": "Number" - } - ], - "id": "route-comparison-1-question", - "title": "Enter your first number", - "type": "General" - } - }, - { - "type": "Question", - "id": "route-comparison-2", - "question": { - "answers": [ - { - "id": "route-comparison-2-answer", - "label": "2nd Number", - "mandatory": true, - "type": "Number" - } - ], - "id": "route-comparison-2-question", - "title": "Enter a higher number to skip the next interstitial", - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - ">": [ - { - "source": "answers", - "identifier": "route-comparison-2-answer" - }, - { - "source": "answers", - "identifier": "route-comparison-1-answer" - } - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "Your second number was lower or equal", - "contents": [ - { - "description": "This page should be skipped if your second answer was higher than your first" - } - ] - } - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "Your second number was higher", - "contents": [ - { - "description": "This page should never be skipped" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_answered_unanswered.json b/schemas/test/en/test_routing_answered_unanswered.json deleted file mode 100644 index ad598a5a8b..0000000000 --- a/schemas/test/en/test_routing_answered_unanswered.json +++ /dev/null @@ -1,242 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.2", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Routing answered/unanswered", - "theme": "default", - "description": "A questionnaire to demo routing when question answered/unanswered", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "block-1", - "question": { - "guidance": { - "contents": [ - { - "description": "Select at least one option to route to the “answered” page otherwise you will be routed to the “unanswered” page" - } - ] - }, - "answers": [ - { - "id": "answer-1", - "mandatory": false, - "options": [ - { - "label": "Cheese", - "value": "Cheese" - }, - { - "label": "Ham", - "value": "Ham" - } - ], - "type": "Checkbox" - } - ], - "id": "question-1", - "title": "What is your favourite pizza topping?", - "type": "General" - }, - "routing_rules": [ - { - "block": "unanswered-question-1", - "when": { - "==": [ - { - "source": "answers", - "identifier": "answer-1" - }, - null - ] - } - }, - { - "block": "answered-question-1" - } - ] - }, - { - "id": "answered-question-1", - "type": "Interstitial", - "content": { - "title": "You answered the first question!" - }, - "routing_rules": [ - { - "block": "block-2" - } - ] - }, - { - "id": "unanswered-question-1", - "type": "Interstitial", - "content": { - "title": "You did not answer the first question!" - } - }, - { - "type": "Question", - "id": "block-2", - "question": { - "guidance": { - "contents": [ - { - "description": "Select at least one option to route to the “answered” page otherwise you will be routed to the “unanswered” page" - } - ] - }, - "answers": [ - { - "id": "answer-2", - "mandatory": false, - "options": [ - { - "label": "Pizza Hut", - "value": "Pizza Hut" - }, - { - "label": "Domino’s", - "value": "Domino’s" - } - ], - "type": "Checkbox" - } - ], - "id": "question-2", - "title": "What is your favourite pizza place?", - "type": "General" - }, - "routing_rules": [ - { - "block": "answered-question-2", - "when": { - "!=": [ - { - "source": "answers", - "identifier": "answer-2" - }, - null - ] - } - }, - { - "block": "unanswered-question-2" - } - ] - }, - { - "id": "answered-question-2", - "type": "Interstitial", - "content": { - "title": "You answered the second question!" - }, - "routing_rules": [ - { - "block": "block-3" - } - ] - }, - { - "id": "unanswered-question-2", - "type": "Interstitial", - "content": { - "title": "You did not answer the second question!" - } - }, - { - "type": "Question", - "id": "block-3", - "question": { - "guidance": { - "contents": [ - { - "description": "Enter a number greater than “0” to route to the “answered” page otherwise you will be routed to the “unanswered or answered 0” page" - } - ] - }, - "answers": [ - { - "id": "answer-3", - "mandatory": false, - "type": "Number", - "label": "Number of slices" - } - ], - "id": "question-3", - "title": "How many pizza slices would you like?", - "type": "General" - }, - "routing_rules": [ - { - "block": "unanswered-or-zero-question-3", - "when": { - "in": [ - { - "source": "answers", - "identifier": "answer-3" - }, - [null, 0] - ] - } - }, - { - "block": "answered-question-3" - } - ] - }, - { - "id": "answered-question-3", - "type": "Interstitial", - "content": { - "title": "You chose at least 1 slice" - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "id": "unanswered-or-zero-question-3", - "type": "Interstitial", - "content": { - "title": "You did not answer the question or chose 0 slices" - } - } - ], - "id": "default-group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_case_insensitive_text_field.json b/schemas/test/en/test_routing_case_insensitive_text_field.json deleted file mode 100644 index 2b910c9284..0000000000 --- a/schemas/test/en/test_routing_case_insensitive_text_field.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.2", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Routing is case insensitive for text fields", - "theme": "default", - "description": "A questionnaire to test case insensitive routing on text fields", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "country-text-field", - "question": { - "id": "country-text-field-question", - "title": "Name a country you have visited", - "type": "General", - "answers": [ - { - "id": "country-text-field-answer", - "label": "Country", - "mandatory": true, - "type": "TextField" - } - ], - "guidance": { - "contents": [ - { - "title": "The following routing should take place", - "list": [ - "Submit ‘India’ or ‘Azerbaijan’ using any mixture of lower or upper case: route to ‘country-interstitial-india-or-azerbaijan’", - "Submit ‘Georgia’ using any mixture of lower or upper case: route to ‘country-interstitial-georgia’" - ] - } - ] - } - }, - "routing_rules": [ - { - "block": "country-interstitial-india-or-azerbaijan", - "when": { - "in": [ - { - "identifier": "country-text-field-answer", - "source": "answers" - }, - ["India", "Azerbaijan"] - ] - } - }, - { - "block": "country-interstitial-georgia", - "when": { - "==": [ - { - "identifier": "country-text-field-answer", - "source": "answers" - }, - "Georgia" - ] - } - }, - { - "section": "End" - } - ] - }, - { - "id": "country-interstitial-georgia", - "type": "Interstitial", - "content": { - "title": "Condition: Submitted Georgia", - "contents": [ - { - "description": "You submitted Georgia." - } - ] - } - }, - { - "id": "country-interstitial-india-or-azerbaijan", - "type": "Interstitial", - "content": { - "title": "Condition: Submitted India or Azerbaijan", - "contents": [ - { - "description": "You submitted India or Azerbaijan." - } - ] - } - } - ], - "id": "countries-visited" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_checkbox_contains.json b/schemas/test/en/test_routing_checkbox_contains.json deleted file mode 100644 index cf16b416ac..0000000000 --- a/schemas/test/en/test_routing_checkbox_contains.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.2", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Other input fields", - "theme": "default", - "description": "A questionnaire to demo checkbox field combined contains routing", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "country-checkbox", - "question": { - "id": "country-checkbox-question", - "title": "Have you visited any of the following countries?", - "type": "General", - "answers": [ - { - "id": "country-checkbox-answer", - "mandatory": false, - "type": "Checkbox", - "options": [ - { - "label": "India", - "value": "India" - }, - { - "label": "Azerbaijan", - "value": "Azerbaijan" - }, - { - "label": "Liechtenstein", - "value": "Liechtenstein" - }, - { - "label": "Malta", - "value": "Malta" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "country-interstitial-all", - "when": { - "all-in": [ - ["India", "Azerbaijan", "Liechtenstein"], - { - "identifier": "country-checkbox-answer", - "source": "answers" - } - ] - } - }, - { - "block": "country-interstitial-any", - "when": { - "any-in": [ - { - "identifier": "country-checkbox-answer", - "source": "answers" - }, - ["India", "Azerbaijan"] - ] - } - }, - { - "section": "End" - } - ] - }, - { - "id": "country-interstitial-any", - "type": "Interstitial", - "content": { - "title": "Condition: Contains Any", - "contents": [ - { - "description": "You chose India or Azerbaijan." - } - ] - } - }, - { - "id": "country-interstitial-all", - "type": "Interstitial", - "content": { - "title": "Condition: Contains All", - "contents": [ - { - "description": "You chose India, Azerbaijan and Liechtenstein." - } - ] - } - } - ], - "id": "checkboxes" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_checkbox_contains_all.json b/schemas/test/en/test_routing_checkbox_contains_all.json deleted file mode 100644 index 20facd96c2..0000000000 --- a/schemas/test/en/test_routing_checkbox_contains_all.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing ALL-IN", - "theme": "default", - "description": "A test survey for routing based on the ALL-IN operator", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "country-checkbox", - "question": { - "id": "country-checkbox-question", - "title": "Have you visited any of the following countries?", - "type": "General", - "guidance": { - "contents": [ - { - "description": "Choose India and Malta here to route to the “correct” page otherwise you will be routed to the “incorrect” page" - } - ] - }, - "answers": [ - { - "id": "country-checkbox-answer", - "mandatory": false, - "type": "Checkbox", - "instruction": "Select India and Malta", - "options": [ - { - "label": "India", - "value": "India" - }, - { - "label": "Azerbaijan", - "value": "Azerbaijan" - }, - { - "label": "Liechtenstein", - "value": "Liechtenstein" - }, - { - "label": "Malta", - "value": "Malta" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "country-interstitial-india-and-malta", - "when": { - "all-in": [ - ["India", "Malta"], - { - "source": "answers", - "identifier": "country-checkbox-answer" - } - ] - } - }, - { - "block": "country-interstitial-not-india-and-malta" - } - ] - }, - { - "id": "country-interstitial-not-india-and-malta", - "type": "Interstitial", - "content": { - "title": "Condition: Does Not Contain India And Malta", - "contents": [ - { - "description": "You did not chose India and Malta." - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "id": "country-interstitial-india-and-malta", - "type": "Interstitial", - "content": { - "title": "Condition: Contained India And Malta", - "contents": [ - { - "description": "You chose India and Malta." - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - } - ], - "id": "checkboxes" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_checkbox_contains_any.json b/schemas/test/en/test_routing_checkbox_contains_any.json deleted file mode 100644 index 11cf519b25..0000000000 --- a/schemas/test/en/test_routing_checkbox_contains_any.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing ANY-IN", - "theme": "default", - "description": "A test survey for routing based on the ANY-IN operator", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "country-checkbox", - "question": { - "id": "country-checkbox-question", - "title": "Have you visited any of the following countries?", - "type": "General", - "guidance": { - "contents": [ - { - "description": "Choose India or Malta (or both) here to route to the “correct” page otherwise you will be routed to the “incorrect” page" - } - ] - }, - "answers": [ - { - "id": "country-checkbox-answer", - "mandatory": false, - "type": "Checkbox", - "instruction": "Select India or Malta (or both)", - "options": [ - { - "label": "India", - "value": "India" - }, - { - "label": "Azerbaijan", - "value": "Azerbaijan" - }, - { - "label": "Liechtenstein", - "value": "Liechtenstein" - }, - { - "label": "Malta", - "value": "Malta" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "country-interstitial-india-or-malta-or-both", - "when": { - "any-in": [ - ["India", "Malta"], - { - "source": "answers", - "identifier": "country-checkbox-answer" - } - ] - } - }, - { - "block": "country-interstitial-not-india-or-malta-or-both" - } - ] - }, - { - "id": "country-interstitial-not-india-or-malta-or-both", - "type": "Interstitial", - "content": { - "title": "Condition: Does Not Contain India Or Malta (Or Both)", - "contents": [ - { - "description": "You did not chose India or Malta (or both)." - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "id": "country-interstitial-india-or-malta-or-both", - "type": "Interstitial", - "content": { - "title": "Condition: Contained India Or Malta (Or Both)", - "contents": [ - { - "description": "You chose India or Malta (or both)." - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - } - ], - "id": "checkboxes" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_checkbox_contains_in.json b/schemas/test/en/test_routing_checkbox_contains_in.json deleted file mode 100644 index 9bb14e81bf..0000000000 --- a/schemas/test/en/test_routing_checkbox_contains_in.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing IN", - "theme": "default", - "description": "A test survey for routing based on the IN operator", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "country-checkbox", - "question": { - "id": "country-checkbox-question", - "title": "Have you visited any of the following countries?", - "type": "General", - "guidance": { - "contents": [ - { - "description": "Choose India here to route to the “correct” page otherwise you will be routed to the “incorrect” page" - } - ] - }, - "answers": [ - { - "id": "country-checkbox-answer", - "mandatory": false, - "type": "Checkbox", - "instruction": "Select India", - "options": [ - { - "label": "India", - "value": "India" - }, - { - "label": "Azerbaijan", - "value": "Azerbaijan" - }, - { - "label": "Liechtenstein", - "value": "Liechtenstein" - }, - { - "label": "Malta", - "value": "Malta" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "country-interstitial-india", - "when": { - "in": [ - "India", - { - "source": "answers", - "identifier": "country-checkbox-answer" - } - ] - } - }, - { - "block": "country-interstitial-not-india" - } - ] - }, - { - "id": "country-interstitial-not-india", - "type": "Interstitial", - "content": { - "title": "Condition: Does Not Contain India", - "contents": [ - { - "description": "You did not chose India." - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "id": "country-interstitial-india", - "type": "Interstitial", - "content": { - "title": "Condition: Contained India", - "contents": [ - { - "description": "You chose India." - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - } - ], - "id": "checkboxes" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_checkbox_count.json b/schemas/test/en/test_routing_checkbox_count.json deleted file mode 100644 index cd351370e2..0000000000 --- a/schemas/test/en/test_routing_checkbox_count.json +++ /dev/null @@ -1,169 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Checkbox Count", - "theme": "default", - "description": "A test survey for routing based on checkbox count", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "topping-checkbox", - "question": { - "answers": [ - { - "id": "topping-checkbox-answer", - "mandatory": false, - "instruction": "Please select 2 or more", - "options": [ - { - "label": "Cheese", - "value": "Cheese" - }, - { - "label": "Ham", - "value": "Ham" - }, - { - "label": "Pineapple", - "value": "Pineapple" - }, - { - "label": "Tuna", - "value": "Tuna" - }, - { - "label": "Pepperoni", - "value": "Pepperoni" - } - ], - "type": "Checkbox" - } - ], - "id": "topping-checkbox-question", - "title": "What extra toppings would you like?", - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - ">=": [ - { - "count": [ - { - "source": "answers", - "identifier": "topping-checkbox-answer" - } - ] - }, - 2 - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "You did not select 2 or more toppings", - "contents": [ - { - "description": { - "text": "You were asked to select 2 or more toppings but you actually selected {answer_count}.", - "placeholders": [ - { - "placeholder": "answer_count", - "transforms": [ - { - "transform": "list_item_count", - "arguments": { - "list_to_count": { - "source": "answers", - "identifier": "topping-checkbox-answer" - } - } - } - ] - } - ] - } - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "You selected 2 or more toppings", - "contents": [ - { - "description": { - "text": "You were asked to select 2 or more toppings and you selected {answer_count}.", - "placeholders": [ - { - "placeholder": "answer_count", - "transforms": [ - { - "transform": "list_item_count", - "arguments": { - "list_to_count": { - "source": "answers", - "identifier": "topping-checkbox-answer" - } - } - } - ] - } - ] - } - } - ] - } - } - ], - "id": "checkboxes" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_date_equals.json b/schemas/test/en/test_routing_date_equals.json deleted file mode 100644 index 3101d2760d..0000000000 --- a/schemas/test/en/test_routing_date_equals.json +++ /dev/null @@ -1,311 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Date Equals", - "theme": "default", - "description": "A test survey for routing based on equal dates", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "comparison-date-block", - "question": { - "answers": [ - { - "id": "comparison-date-answer", - "mandatory": true, - "type": "Date" - } - ], - "id": "comparison-date-question", - "title": "Title", - "type": "General", - "guidance": { - "contents": [ - { - "title": "If you enter 31/03/2018 the following dates will be valid", - "list": [ - "Yesterday 30/03/2018", - "Today 31/03/2018", - "Tomorrow 01/04/2018", - "Last Month 28/02/2018 (28th as no 31st February)", - "Next Month 30/04/2018 (30th as no 31st April)", - "Last Year 31/03/2017", - "Next Year 31/03/2019" - ] - } - ] - } - } - }, - { - "type": "Question", - "id": "date-question", - "question": { - "answers": [ - { - "id": "single-date-answer", - "label": "Today", - "mandatory": true, - "type": "Date" - } - ], - "id": "date-questions", - "title": { - "text": "Enter {date} or offset by one day, month or year in either direction", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "answers", - "identifier": "comparison-date-answer" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - "or": [ - { - "==": [ - { - "date": [ - { - "source": "answers", - "identifier": "single-date-answer" - } - ] - }, - { - "date": [ - { - "source": "answers", - "identifier": "comparison-date-answer" - }, - { - "days": -1 - } - ] - } - ] - }, - { - "==": [ - { - "date": [ - { - "source": "answers", - "identifier": "single-date-answer" - } - ] - }, - { - "date": [ - { - "source": "answers", - "identifier": "comparison-date-answer" - } - ] - } - ] - }, - { - "==": [ - { - "date": [ - { - "source": "answers", - "identifier": "single-date-answer" - } - ] - }, - { - "date": [ - { - "source": "answers", - "identifier": "comparison-date-answer" - }, - { - "days": 1 - } - ] - } - ] - }, - { - "==": [ - { - "date": [ - { - "source": "answers", - "identifier": "single-date-answer" - } - ] - }, - { - "date": [ - { - "source": "answers", - "identifier": "comparison-date-answer" - }, - { - "months": -1 - } - ] - } - ] - }, - { - "==": [ - { - "date": [ - { - "source": "answers", - "identifier": "single-date-answer" - } - ] - }, - { - "date": [ - { - "source": "answers", - "identifier": "comparison-date-answer" - }, - { - "months": 1 - } - ] - } - ] - }, - { - "==": [ - { - "date": [ - { - "source": "answers", - "identifier": "single-date-answer" - } - ] - }, - { - "date": [ - { - "source": "answers", - "identifier": "comparison-date-answer" - }, - { - "years": -1 - } - ] - } - ] - }, - { - "==": [ - { - "date": [ - { - "source": "answers", - "identifier": "single-date-answer" - } - ] - }, - { - "date": [ - { - "source": "answers", - "identifier": "comparison-date-answer" - }, - { - "years": 1 - } - ] - } - ] - } - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "Incorrect Date", - "contents": [ - { - "description": "You entered an incorrect date" - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "Correct Date", - "contents": [ - { - "description": "You entered a correct date." - } - ] - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_date_greater_than.json b/schemas/test/en/test_routing_date_greater_than.json deleted file mode 100644 index cecc09776f..0000000000 --- a/schemas/test/en/test_routing_date_greater_than.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Date Greater Than", - "theme": "default", - "description": "A test survey for routing based on a date greater than", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "return_by", - "type": "date" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "date-question", - "question": { - "answers": [ - { - "id": "single-date-answer", - "mandatory": true, - "type": "Date" - } - ], - "id": "date-questions", - "title": { - "text": "Enter a date greater than Return date: {date}", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "return_by" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - }, - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - ">": [ - { - "date": [{ "source": "answers", "identifier": "single-date-answer" }] - }, - { - "date": [{ "source": "metadata", "identifier": "return_by" }] - } - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "Incorrect answer", - "contents": [ - { - "description": { - "text": "You entered a return date earlier than {date}", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "return_by" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - } - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "Correct answer", - "contents": [ - { - "description": { - "text": "You entered a return date later than {date}", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "return_by" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - } - } - ] - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_date_greater_than_or_equals.json b/schemas/test/en/test_routing_date_greater_than_or_equals.json deleted file mode 100644 index aff5d6d350..0000000000 --- a/schemas/test/en/test_routing_date_greater_than_or_equals.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Date Greater Than Or Equals", - "theme": "default", - "description": "A test survey for routing based on a date greater than or equals", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "return_by", - "type": "date" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "date-question", - "question": { - "answers": [ - { - "id": "single-date-answer", - "mandatory": true, - "type": "YearDate" - } - ], - "id": "date-questions", - "title": "Enter a year greater than or equals to 2018", - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - ">=": [ - { - "date": [{ "source": "answers", "identifier": "single-date-answer" }] - }, - { - "date": ["2018"] - } - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "Incorrect answer", - "contents": [ - { - "description": { - "text": "You entered a return date earlier than {date}", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "return_by" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - } - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "Correct answer", - "contents": [ - { - "description": { - "text": "You entered a return date later than {date}", - "placeholders": [ - { - "placeholder": "date", - "transforms": [ - { - "transform": "format_date", - "arguments": { - "date_to_format": { - "source": "metadata", - "identifier": "return_by" - }, - "date_format": "d MMMM yyyy" - } - } - ] - } - ] - } - } - ] - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_date_less_than.json b/schemas/test/en/test_routing_date_less_than.json deleted file mode 100644 index 30925081ff..0000000000 --- a/schemas/test/en/test_routing_date_less_than.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Date Less Than", - "theme": "default", - "description": "A test survey for routing based on a Date less than", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "date-question", - "question": { - "answers": [ - { - "id": "single-date-answer", - "label": "Today", - "mandatory": true, - "type": "Date" - } - ], - "id": "date-questions", - "title": "Enter a date less than Today", - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - "<": [ - { - "date": [{ "source": "answers", "identifier": "single-date-answer" }] - }, - { - "date": ["now"] - } - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "Incorrect answer", - "contents": [ - { - "description": "You entered a date later than yesterday." - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "Correct answer", - "contents": [ - { - "description": "You entered a date older than Today." - } - ] - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_date_less_than_or_equals.json b/schemas/test/en/test_routing_date_less_than_or_equals.json deleted file mode 100644 index 1e703687d2..0000000000 --- a/schemas/test/en/test_routing_date_less_than_or_equals.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Date Less Than Or Equals", - "theme": "default", - "description": "A test survey for routing based on a Date less than or equals", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "date-question", - "question": { - "answers": [ - { - "id": "single-date-answer", - "label": "Today", - "mandatory": true, - "type": "Date" - } - ], - "id": "date-questions", - "title": "Enter a date less than or equals Today", - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - "<=": [ - { - "date": [{ "source": "answers", "identifier": "single-date-answer" }] - }, - { - "date": ["now"] - } - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "Incorrect answer", - "contents": [ - { - "description": "You entered a date later than yesterday." - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "Correct answer", - "contents": [ - { - "description": "You entered a date older than Today." - } - ] - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_date_not_equals.json b/schemas/test/en/test_routing_date_not_equals.json deleted file mode 100644 index 0cbb7d5ee8..0000000000 --- a/schemas/test/en/test_routing_date_not_equals.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Date Not Equals", - "theme": "default", - "description": "A test survey for routing based on a date not equals", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "date-question", - "question": { - "answers": [ - { - "id": "single-date-answer", - "label": "Today", - "mandatory": true, - "type": "MonthYearDate" - } - ], - "id": "date-questions", - "title": "Enter a date other than February 2018", - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - "!=": [ - { - "date": [{ "source": "answers", "identifier": "single-date-answer" }] - }, - { - "date": ["2018-02"] - } - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "Incorrect Date", - "contents": [ - { - "description": "You entered 28 February 2018." - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "Correct Date", - "contents": [ - { - "description": "You entered a date other than 28 February 2018." - } - ] - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_group.json b/schemas/test/en/test_routing_group.json deleted file mode 100644 index 1370f2f529..0000000000 --- a/schemas/test/en/test_routing_group.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Routing Group", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "which-group", - "title": "What group do you want to go to?", - "blocks": [ - { - "type": "Question", - "id": "which-group-block", - "question": { - "id": "which-group-question", - "title": "Select Group", - "type": "General", - "answers": [ - { - "id": "which-group-answer", - "label": "Choose next group", - "mandatory": true, - "options": [ - { - "label": "Group 1", - "value": "Group 1" - }, - { - "label": "Group 2", - "value": "Group 2" - } - ], - "type": "Radio", - "validation": { - "messages": {} - } - } - ] - }, - "routing_rules": [ - { - "group": "group1", - "when": { - "==": [ - { - "identifier": "which-group-answer", - "source": "answers" - }, - "Group 1" - ] - } - }, - { - "group": "group2" - } - ] - } - ] - }, - { - "id": "group1", - "title": "This is Group 1", - "blocks": [ - { - "type": "Question", - "id": "group1-block", - "question": { - "id": "group1-question", - "title": "Did you want Group 1?", - "type": "General", - "answers": [ - { - "id": "group1-answer", - "label": "Why did you choose Group 1?", - "mandatory": true, - "type": "TextArea" - } - ] - } - } - ] - }, - { - "id": "group2", - "title": "This is Group 2", - "blocks": [ - { - "type": "Question", - "id": "group2-block", - "question": { - "id": "group2-question", - "title": "Did you want Group 2?", - "type": "General", - "answers": [ - { - "id": "group2-answer", - "label": "Why did you choose Group 2?", - "mandatory": true, - "type": "TextArea" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_not.json b/schemas/test/en/test_routing_not.json deleted file mode 100644 index 76327eeb07..0000000000 --- a/schemas/test/en/test_routing_not.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Not", - "theme": "default", - "description": "A test survey for routing based on the NOT operator", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "country-checkbox", - "question": { - "id": "country-checkbox-question", - "title": "Have you visited any of the following countries?", - "type": "General", - "answers": [ - { - "id": "country-checkbox-answer", - "mandatory": false, - "type": "Checkbox", - "instruction": "Do not select India", - "options": [ - { - "label": "India", - "value": "India" - }, - { - "label": "Azerbaijan", - "value": "Azerbaijan" - }, - { - "label": "Liechtenstein", - "value": "Liechtenstein" - }, - { - "label": "Malta", - "value": "Malta" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "country-interstitial-not-india", - "when": { - "not": [ - { - "in": [ - "India", - { - "source": "answers", - "identifier": "country-checkbox-answer" - } - ] - } - ] - } - }, - { - "block": "country-interstitial-india" - } - ] - }, - { - "id": "country-interstitial-not-india", - "type": "Interstitial", - "content": { - "title": "Condition: Does not contain India", - "contents": [ - { - "description": "You did not chose India." - } - ] - } - }, - { - "id": "country-interstitial-india", - "type": "Interstitial", - "content": { - "title": "Condition: Contained India", - "contents": [ - { - "description": "You chose India." - } - ] - } - } - ], - "id": "checkboxes" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_not_affected_by_answers_not_on_path.json b/schemas/test/en/test_routing_not_affected_by_answers_not_on_path.json deleted file mode 100644 index 7332f007ab..0000000000 --- a/schemas/test/en/test_routing_not_affected_by_answers_not_on_path.json +++ /dev/null @@ -1,197 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test routing not affected by invalid answers", - "theme": "default", - "description": "A test survey to make sure previous answers that are not on the routing path do not affect routing", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "initial-choice", - "question": { - "type": "General", - "id": "initial-choice-question", - "title": "Answer First, then, after answering a question, go back to this question and answer Second", - "answers": [ - { - "type": "Radio", - "id": "initial-choice-answer", - "mandatory": true, - "options": [ - { - "label": "Go here first", - "value": "Go here first" - }, - { - "label": "Go here second", - "value": "Go here second" - } - ] - } - ] - }, - "routing_rules": [ - { - "block": "valid-path", - "when": { - "==": [ - { - "identifier": "initial-choice-answer", - "source": "answers" - }, - "Go here second" - ] - } - }, - { - "block": "invalid-path" - } - ] - }, - { - "type": "Question", - "id": "invalid-path", - "question": { - "answers": [ - { - "id": "invalid-path-answer", - "mandatory": true, - "label": "Number", - "type": "Number" - } - ], - "id": "invalid-path-question", - "title": "Enter a number", - "type": "General" - } - }, - { - "type": "Interstitial", - "id": "invalid-path-interstitial", - "content": { - "title": "You now have an answer that could be invalid in the store.", - "contents": [ - { - "description": "Go back to the first question and choose the second path." - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Question", - "id": "valid-path", - "question": { - "answers": [ - { - "id": "valid-path-answer", - "mandatory": true, - "type": "Number", - "label": "Number" - } - ], - "id": "valid-path-question", - "title": "Enter a number and continue", - "type": "General" - }, - "routing_rules": [ - { - "block": "invalid-final-interstitial", - "when": { - "!=": [ - { - "identifier": "invalid-path-answer", - "source": "answers" - }, - null - ] - } - }, - { - "block": "valid-skipped-interstitial" - } - ] - }, - { - "type": "Interstitial", - "id": "valid-skipped-interstitial", - "content": { - "title": "This page should have been skipped!" - }, - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "invalid-path-answer", - "source": "answers" - }, - null - ] - } - } - }, - { - "type": "Interstitial", - "id": "valid-final-interstitial", - "content": { - "title": "You were routed correctly!" - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "invalid-final-interstitial", - "content": { - "title": "You were routed incorrectly!" - }, - "routing_rules": [ - { - "section": "End" - } - ] - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_number_equals.json b/schemas/test/en/test_routing_number_equals.json deleted file mode 100644 index 83c33bf109..0000000000 --- a/schemas/test/en/test_routing_number_equals.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Number Equals", - "theme": "default", - "description": "A test survey for routing based on a number equals", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "number-question", - "question": { - "answers": [ - { - "id": "answer", - "mandatory": true, - "type": "Number", - "label": "Enter 123" - } - ], - "id": "question", - "title": "Enter the number 123", - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - "==": [ - { - "source": "answers", - "identifier": "answer" - }, - 123 - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "You did not enter 123", - "contents": [ - { - "description": { - "text": "You were asked to enter 123 but you actually entered {answer}.", - "placeholders": [ - { - "placeholder": "answer", - "value": { - "source": "answers", - "identifier": "answer" - } - } - ] - } - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "Correct", - "contents": [ - { - "description": { - "text": "You were asked to enter 123 and you entered {answer}.", - "placeholders": [ - { - "placeholder": "answer", - "value": { - "source": "answers", - "identifier": "answer" - } - } - ] - } - } - ] - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_number_greater_than.json b/schemas/test/en/test_routing_number_greater_than.json deleted file mode 100644 index 1e5f8552b5..0000000000 --- a/schemas/test/en/test_routing_number_greater_than.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Number Greater Than", - "theme": "default", - "description": "A test survey for routing based on a number greater than", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "number-question", - "question": { - "answers": [ - { - "id": "answer", - "mandatory": true, - "type": "Number", - "label": "Enter a number greater than 123" - } - ], - "id": "question", - "title": "Enter a number greater than 123", - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - ">": [ - { - "source": "answers", - "identifier": "answer" - }, - 123 - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "You did not enter a number greater than 123", - "contents": [ - { - "description": { - "text": "You were asked to enter a number greater than 123 but you actually entered {answer}.", - "placeholders": [ - { - "placeholder": "answer", - "value": { - "source": "answers", - "identifier": "answer" - } - } - ] - } - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "Correct", - "contents": [ - { - "description": { - "text": "You were asked to enter a number greater than 123 and you entered {answer}.", - "placeholders": [ - { - "placeholder": "answer", - "value": { - "source": "answers", - "identifier": "answer" - } - } - ] - } - } - ] - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_number_greater_than_or_equal.json b/schemas/test/en/test_routing_number_greater_than_or_equal.json deleted file mode 100644 index b0096acdf8..0000000000 --- a/schemas/test/en/test_routing_number_greater_than_or_equal.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Number Greater Than Or Equal To", - "theme": "default", - "description": "A test survey for routing based on a number greater than or equal to", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "number-question", - "question": { - "answers": [ - { - "id": "answer", - "mandatory": true, - "type": "Number", - "label": "123 or greater" - } - ], - "id": "question", - "title": "Enter the number greater than or equal to 123", - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - ">=": [ - { - "source": "answers", - "identifier": "answer" - }, - 123 - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "Incorrect answer", - "contents": [ - { - "description": { - "text": "You were asked to enter a number greater than or equal to 123 but you entered {answer}.", - "placeholders": [ - { - "placeholder": "answer", - "value": { - "source": "answers", - "identifier": "answer" - } - } - ] - } - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "Correct answer", - "contents": [ - { - "description": { - "text": "You were asked to enter a number greater than or equal to 123 and you entered {answer}.", - "placeholders": [ - { - "placeholder": "answer", - "value": { - "source": "answers", - "identifier": "answer" - } - } - ] - } - } - ] - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_number_greater_than_or_equal_single_condition.json b/schemas/test/en/test_routing_number_greater_than_or_equal_single_condition.json deleted file mode 100644 index b16a50963d..0000000000 --- a/schemas/test/en/test_routing_number_greater_than_or_equal_single_condition.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Number Greater Than or Equal", - "theme": "default", - "description": "A test survey for routing based on a number greater than or equal", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "number-question", - "question": { - "answers": [ - { - "id": "answer", - "mandatory": true, - "type": "Number", - "label": "123 or greater" - } - ], - "id": "question", - "title": "Enter the number greater than or equal to 123", - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - ">=": [ - { - "source": "answers", - "identifier": "answer" - }, - 123 - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "Incorrect answer", - "contents": [ - { - "description": { - "text": "You were asked to enter a number greater than or equal to 123 but you entered {answer}.", - "placeholders": [ - { - "placeholder": "answer", - "value": { - "source": "answers", - "identifier": "answer" - } - } - ] - } - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "Correct answer", - "contents": [ - { - "description": { - "text": "You were asked to enter a number greater than or equal to 123 and you entered {answer}.", - "placeholders": [ - { - "placeholder": "answer", - "value": { - "source": "answers", - "identifier": "answer" - } - } - ] - } - } - ] - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_number_less_than.json b/schemas/test/en/test_routing_number_less_than.json deleted file mode 100644 index ed5eec019f..0000000000 --- a/schemas/test/en/test_routing_number_less_than.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Number Less Than", - "theme": "default", - "description": "A test survey for routing based on a number less than", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "number-question", - "question": { - "answers": [ - { - "id": "answer", - "mandatory": true, - "type": "Number", - "label": "Enter a number less than 123" - } - ], - "id": "question", - "title": "Enter a number less than 123", - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - "<": [ - { - "source": "answers", - "identifier": "answer" - }, - 123 - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "You did not enter a number less than 123", - "contents": [ - { - "description": { - "text": "You were asked to enter a number less than 123 but you actually entered {answer}.", - "placeholders": [ - { - "placeholder": "answer", - "value": { - "source": "answers", - "identifier": "answer" - } - } - ] - } - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "Correct", - "contents": [ - { - "description": { - "text": "You were asked to enter a number less than 123 and you entered {answer}.", - "placeholders": [ - { - "placeholder": "answer", - "value": { - "source": "answers", - "identifier": "answer" - } - } - ] - } - } - ] - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_number_less_than_or_equal.json b/schemas/test/en/test_routing_number_less_than_or_equal.json deleted file mode 100644 index d45041fd8a..0000000000 --- a/schemas/test/en/test_routing_number_less_than_or_equal.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Number Less Than Or Equal To", - "theme": "default", - "description": "A test survey for routing based on a number less than or equal to", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "number-question", - "question": { - "answers": [ - { - "id": "answer", - "mandatory": true, - "type": "Number", - "label": "Number" - } - ], - "id": "question", - "title": "Enter the number less than or equal to 123", - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - "<=": [ - { - "source": "answers", - "identifier": "answer" - }, - 123 - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "Incorrect answer", - "contents": [ - { - "description": { - "text": "You were asked to enter a number less than or equal to 123 but you entered {answer}.", - "placeholders": [ - { - "placeholder": "answer", - "value": { - "source": "answers", - "identifier": "answer" - } - } - ] - } - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "Correct answer", - "contents": [ - { - "description": { - "text": "You were asked to enter a number less than or equal to 123 and you entered {answer}.", - "placeholders": [ - { - "placeholder": "answer", - "value": { - "source": "answers", - "identifier": "answer" - } - } - ] - } - } - ] - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_number_less_than_or_equal_single_condition.json b/schemas/test/en/test_routing_number_less_than_or_equal_single_condition.json deleted file mode 100644 index ef8ba8b256..0000000000 --- a/schemas/test/en/test_routing_number_less_than_or_equal_single_condition.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Number less Than or Equal", - "theme": "default", - "description": "A test survey for routing based on a number less than or equal", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "number-question", - "question": { - "answers": [ - { - "id": "answer", - "mandatory": true, - "type": "Number", - "label": "Number" - } - ], - "id": "question", - "title": "Enter the number less than or equal to 123", - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - "<=": [ - { - "source": "answers", - "identifier": "answer" - }, - 123 - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "Incorrect answer", - "contents": [ - { - "description": { - "text": "You were asked to enter a number less than or equal to 123 but you entered {answer}.", - "placeholders": [ - { - "placeholder": "answer", - "value": { - "source": "answers", - "identifier": "answer" - } - } - ] - } - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "Correct answer", - "contents": [ - { - "description": { - "text": "You were asked to enter a number less than or equal to 123 and you entered {answer}.", - "placeholders": [ - { - "placeholder": "answer", - "value": { - "source": "answers", - "identifier": "answer" - } - } - ] - } - } - ] - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_number_not_equals.json b/schemas/test/en/test_routing_number_not_equals.json deleted file mode 100644 index e0c7505133..0000000000 --- a/schemas/test/en/test_routing_number_not_equals.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Number Not Equals", - "theme": "default", - "description": "A test survey for routing based on a number not equals", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "number-question", - "question": { - "answers": [ - { - "id": "answer", - "mandatory": true, - "type": "Number", - "label": "Not 123" - } - ], - "id": "question", - "title": "Enter the number that isn’t 123", - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - "!=": [ - { - "source": "answers", - "identifier": "answer" - }, - 123 - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "Incorrect answer", - "contents": [ - { - "description": { - "text": "You were asked not to enter 123 but you entered {answer}.", - "placeholders": [ - { - "placeholder": "answer", - "value": { - "source": "answers", - "identifier": "answer" - } - } - ] - } - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "Correct answer", - "contents": [ - { - "description": { - "text": "You were asked not to enter 123 and you entered {answer}.", - "placeholders": [ - { - "placeholder": "answer", - "value": { - "source": "answers", - "identifier": "answer" - } - } - ] - } - } - ] - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_on_multiple_select.json b/schemas/test/en/test_routing_on_multiple_select.json deleted file mode 100644 index 312b654f2d..0000000000 --- a/schemas/test/en/test_routing_on_multiple_select.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test schema for routing on multiple selected answers", - "description": "Test schema for routing on multiple selected answers", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "group1", - "title": "Group 1", - "blocks": [ - { - "type": "Question", - "id": "block1", - "question": { - "id": "block1-question", - "title": "Question 1", - "type": "General", - "answers": [ - { - "id": "passports-answer", - "mandatory": false, - "options": [ - { - "label": "United Kingdom", - "value": "United Kingdom" - }, - { - "label": "Irish", - "value": "Irish" - }, - { - "label": "None", - "value": "None" - } - ], - "type": "Checkbox" - } - ] - }, - "routing_rules": [ - { - "block": "block3", - "when": { - "in": [ - "United Kingdom", - { - "identifier": "passports-answer", - "source": "answers" - } - ] - } - }, - { - "block": "block2" - } - ] - }, - { - "type": "Question", - "id": "block2", - "question": { - "id": "block2-question", - "title": "Question 2", - "type": "General", - "answers": [ - { - "id": "block2-answer", - "label": "Question 2", - "mandatory": false, - "type": "TextField" - } - ] - } - }, - { - "type": "Question", - "id": "block3", - "question": { - "id": "block3-question", - "title": "Question 3", - "type": "General", - "answers": [ - { - "id": "block3-answer", - "label": "Question 3", - "mandatory": false, - "type": "TextField" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_or.json b/schemas/test/en/test_routing_or.json deleted file mode 100644 index 0b888a557c..0000000000 --- a/schemas/test/en/test_routing_or.json +++ /dev/null @@ -1,180 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Or", - "theme": "default", - "description": "A test survey for routing based on the OR operator", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "number-question-1", - "question": { - "guidance": { - "contents": [ - { - "description": "Enter 123 here OR 321 on the next question to route to the “correct” page otherwise you will be routed to the “incorrect” page" - } - ] - }, - "answers": [ - { - "id": "answer-1", - "mandatory": true, - "type": "Number", - "label": "Enter 123" - } - ], - "id": "question-1", - "title": "Enter the number 123", - "type": "General" - } - }, - { - "type": "Question", - "id": "number-question-2", - "question": { - "answers": [ - { - "id": "answer-2", - "mandatory": true, - "type": "Number", - "label": "Enter 321" - } - ], - "id": "question-2", - "title": "Enter the number 321", - "type": "General" - }, - "routing_rules": [ - { - "block": "correct-answer", - "when": { - "or": [ - { - "==": [ - { - "source": "answers", - "identifier": "answer-1" - }, - 123 - ] - }, - { - "==": [ - { - "source": "answers", - "identifier": "answer-2" - }, - 321 - ] - } - ] - } - }, - { - "block": "incorrect-answer" - } - ] - }, - { - "type": "Interstitial", - "id": "incorrect-answer", - "content": { - "title": "You did not enter a correct answer", - "contents": [ - { - "description": { - "text": "You were asked to enter 123 or 321 but you actually entered {answer_1} and {answer_2}.", - "placeholders": [ - { - "placeholder": "answer_1", - "value": { - "source": "answers", - "identifier": "answer-1" - } - }, - { - "placeholder": "answer_2", - "value": { - "source": "answers", - "identifier": "answer-2" - } - } - ] - } - } - ] - }, - "routing_rules": [ - { - "section": "End" - } - ] - }, - { - "type": "Interstitial", - "id": "correct-answer", - "content": { - "title": "Correct", - "contents": [ - { - "description": { - "text": "You were asked to enter 123 or 321 and you entered {answer_1} and {answer_2}.", - "placeholders": [ - { - "placeholder": "answer_1", - "value": { - "source": "answers", - "identifier": "answer-1" - } - }, - { - "placeholder": "answer_2", - "value": { - "source": "answers", - "identifier": "answer-2" - } - } - ] - } - } - ] - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_to_questionnaire_end_multiple_sections.json b/schemas/test/en/test_routing_to_questionnaire_end_multiple_sections.json deleted file mode 100644 index 18f1fe51a5..0000000000 --- a/schemas/test/en/test_routing_to_questionnaire_end_multiple_sections.json +++ /dev/null @@ -1,152 +0,0 @@ -{ - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "137", - "theme": "default", - "title": "Test Routing To Questionnaire End (Multiple Sections)", - "mime_type": "application/json/ons/eq", - "navigation": { - "visible": true - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "test-section", - "title": "Section 1", - "groups": [ - { - "blocks": [ - { - "id": "test-forced", - "question": { - "title": "Would you like to complete section 2?", - "answers": [ - { - "id": "test-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "test-question", - "type": "General" - }, - "type": "Question", - "routing_rules": [ - { - "when": { - "==": [ - { - "source": "answers", - "identifier": "test-answer" - }, - "No" - ] - }, - "section": "End" - }, - { - "group": "test-group-2", - "when": { - "==": [ - { - "source": "answers", - "identifier": "test-answer" - }, - "Yes" - ] - } - }, - { - "section": "End" - } - ] - } - ], - "id": "test-group", - "title": "Section 1" - } - ] - }, - { - "id": "test-section-2", - "title": "Section 2", - "enabled": { - "when": { - "==": [ - "Yes", - { - "source": "answers", - "identifier": "test-answer" - } - ] - } - }, - "groups": [ - { - "blocks": [ - { - "id": "test-optional", - "type": "Question", - "question": { - "answers": [ - { - "id": "test-optional-answer", - "mandatory": true, - "options": [ - { - "label": "I am a completionist", - "value": "I am a completionist" - }, - { - "label": "Other", - "value": "Other" - } - ], - "type": "Radio" - } - ], - "id": "test-optional-question", - "title": "Why did you choose to complete this section?", - "type": "General" - } - } - ], - "id": "test-group-2", - "title": "Section 2" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_to_questionnaire_end_single_section.json b/schemas/test/en/test_routing_to_questionnaire_end_single_section.json deleted file mode 100644 index ea17355008..0000000000 --- a/schemas/test/en/test_routing_to_questionnaire_end_single_section.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "137", - "theme": "default", - "title": "Test Routing To Questionnaire End (Single Section)", - "mime_type": "application/json/ons/eq", - "navigation": { - "visible": true - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "test-section", - "title": "Section 1", - "groups": [ - { - "blocks": [ - { - "id": "test-forced", - "question": { - "title": "Would you like to complete question 2?", - "answers": [ - { - "id": "test-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "test-question", - "type": "General" - }, - "type": "Question", - "routing_rules": [ - { - "when": { - "==": [ - { - "source": "answers", - "identifier": "test-answer" - }, - "No" - ] - }, - "section": "End" - }, - { - "group": "test-group-2", - "when": { - "==": [ - { - "source": "answers", - "identifier": "test-answer" - }, - "Yes" - ] - } - }, - { - "section": "End" - } - ] - } - ], - "id": "test-group", - "title": "Group 1" - }, - { - "blocks": [ - { - "id": "test-optional", - "type": "Question", - "question": { - "answers": [ - { - "id": "test-optional-answer", - "mandatory": true, - "options": [ - { - "label": "I am a completionist", - "value": "I am a completionist" - }, - { - "label": "Other", - "value": "Other" - } - ], - "type": "Radio" - } - ], - "id": "test-optional-question", - "title": "Why did you choose to complete this question?", - "type": "General" - } - } - ], - "id": "test-group-2", - "title": "Group 2" - } - ] - } - ] -} diff --git a/schemas/test/en/test_routing_to_section_end.json b/schemas/test/en/test_routing_to_section_end.json deleted file mode 100644 index a27707979b..0000000000 --- a/schemas/test/en/test_routing_to_section_end.json +++ /dev/null @@ -1,204 +0,0 @@ -{ - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "137", - "theme": "default", - "title": "Test Routing To Section End", - "mime_type": "application/json/ons/eq", - "navigation": { - "visible": true - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "test-section", - "title": "Section 1", - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "blocks": [ - { - "id": "test-forced", - "question": { - "title": "Were you forced to complete section 1?", - "answers": [ - { - "id": "test-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "test-question", - "type": "General" - }, - "type": "Question", - "routing_rules": [ - { - "block": "test-optional", - "when": { - "==": [ - { - "identifier": "test-answer", - "source": "answers" - }, - "Yes" - ] - } - }, - { - "section": "End" - } - ] - }, - { - "id": "test-optional", - "type": "Question", - "question": { - "answers": [ - { - "id": "test-optional-answer", - "mandatory": true, - "options": [ - { - "label": "£5 Cash", - "value": "£5 Cash" - }, - { - "label": "£10 Amazon Voucher", - "value": "£10 Amazon Voucher" - } - ], - "type": "Checkbox" - } - ], - "id": "test-optional-question", - "title": "What would incentivise you to complete this section?", - "type": "General" - } - } - ], - "id": "test-group", - "title": "Section 1" - } - ] - }, - { - "id": "test-section-2", - "title": "Section 2", - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "blocks": [ - { - "id": "test-forced-2", - "question": { - "answers": [ - { - "id": "test-answer-2", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "test-question-2", - "title": "Were you forced to complete section 2?", - "type": "General" - }, - "type": "Question", - "routing_rules": [ - { - "block": "test-optional-2", - "when": { - "==": [ - { - "identifier": "test-answer-2", - "source": "answers" - }, - "Yes" - ] - } - }, - { - "section": "End" - } - ] - }, - { - "id": "test-optional-2", - "type": "Question", - "question": { - "answers": [ - { - "id": "test-optional-answer-2", - "mandatory": true, - "options": [ - { - "label": "£5 Cash", - "value": "£5 Cash" - }, - { - "label": "£10 Amazon Voucher", - "value": "£10 Amazon Voucher" - } - ], - "type": "Checkbox" - } - ], - "id": "test-optional-question-2", - "title": "What would incentivise you to complete this section?", - "type": "General" - } - } - ], - "id": "test-group-2", - "title": "Section 2" - } - ] - } - ] -} diff --git a/schemas/test/en/test_section_enabled_checkbox.json b/schemas/test/en/test_section_enabled_checkbox.json deleted file mode 100644 index 7c60b826c5..0000000000 --- a/schemas/test/en/test_section_enabled_checkbox.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Section Enabled", - "theme": "default", - "description": "A questionnaire to demo section enabled key usage with checkbox options", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section-1", - "title": "Section 1", - "groups": [ - { - "blocks": [ - { - "id": "section-1-block", - "type": "Question", - "question": { - "answers": [ - { - "id": "section-1-answer", - "label": "label 1", - "mandatory": false, - "options": [ - { - "label": "Section 2", - "value": "Section 2" - }, - { - "label": "Section 3", - "value": "Section 3" - } - ], - "type": "Checkbox" - }, - { - "id": "section-1-answer-exclusive", - "mandatory": false, - "options": [ - { - "label": "Neither", - "value": "Neither" - } - ], - "type": "Checkbox" - } - ], - "mandatory": false, - "description": ["This is section 1."], - "id": "section-1-question", - "title": "Which sections do you want to enable?", - "type": "MutuallyExclusive" - } - } - ], - "id": "section-1-group", - "title": "Section 1" - } - ] - }, - { - "id": "section-2", - "title": "Section 2", - "enabled": { - "when": { - "in": [ - "Section 2", - { - "source": "answers", - "identifier": "section-1-answer" - } - ] - } - }, - "groups": [ - { - "blocks": [ - { - "id": "section-2-block", - "type": "Question", - "question": { - "answers": [ - { - "id": "section-2-answer", - "label": "label 2", - "mandatory": false, - "type": "Number" - } - ], - "description": ["This is section 2."], - "id": "section-2-question", - "title": "Which section is this?", - "type": "General" - } - } - ], - "id": "section-2-group", - "title": "Section 2" - } - ] - }, - { - "id": "section-3", - "title": "Section 3", - "enabled": { - "when": { - "in": [ - "Section 3", - { - "source": "answers", - "identifier": "section-1-answer" - } - ] - } - }, - "groups": [ - { - "blocks": [ - { - "id": "section-3-block", - "type": "Question", - "question": { - "answers": [ - { - "id": "section-3-answer", - "label": "label 3", - "mandatory": false, - "type": "Number" - } - ], - "description": ["This is section 3."], - "id": "section-3-question", - "title": "Which section is this?", - "type": "General" - } - } - ], - "id": "section-3-group", - "title": "Section 3" - } - ] - } - ] -} diff --git a/schemas/test/en/test_section_enabled_hub.json b/schemas/test/en/test_section_enabled_hub.json deleted file mode 100644 index 5f6e82f73b..0000000000 --- a/schemas/test/en/test_section_enabled_hub.json +++ /dev/null @@ -1,163 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Section Enabled", - "theme": "default", - "description": "A questionnaire to demo section enabled key usage with hub enabled", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { "required_completed_sections": ["section-1"] } - }, - "sections": [ - { - "id": "section-1", - "title": "Section 1", - "groups": [ - { - "blocks": [ - { - "id": "section-1-block", - "type": "Question", - "question": { - "answers": [ - { - "id": "section-1-answer", - "mandatory": false, - "options": [ - { - "label": "Section 2", - "value": "Section 2" - }, - { - "label": "Section 3", - "value": "Section 3" - } - ], - "type": "Checkbox" - }, - { - "id": "section-1-answer-exclusive", - "mandatory": false, - "options": [ - { - "label": "Neither", - "value": "Neither" - } - ], - "type": "Checkbox" - } - ], - "mandatory": false, - "description": ["This is section 1."], - "id": "section-1-question", - "title": "Which sections do you want to enable?", - "type": "MutuallyExclusive" - } - } - ], - "id": "section-1-group", - "title": "Section 1" - } - ] - }, - { - "id": "section-2", - "title": "Section 2", - "enabled": { - "when": { - "in": [ - "Section 2", - { - "source": "answers", - "identifier": "section-1-answer" - } - ] - } - }, - "groups": [ - { - "blocks": [ - { - "id": "section-2-block", - "type": "Question", - "question": { - "answers": [ - { - "id": "section-2-answer", - "label": "Section 2", - "mandatory": false, - "type": "Number" - } - ], - "description": ["This is section 2."], - "id": "section-2-question", - "title": "Which section is this?", - "type": "General" - } - } - ], - "id": "section-2-group", - "title": "Section 2" - } - ] - }, - { - "id": "section-3", - "title": "Section 3", - "enabled": { - "when": { - "in": [ - "Section 3", - { - "source": "answers", - "identifier": "section-1-answer" - } - ] - } - }, - "groups": [ - { - "blocks": [ - { - "id": "section-3-block", - "type": "Question", - "question": { - "answers": [ - { - "id": "section-3-answer", - "label": "Section 3", - "mandatory": false, - "type": "Number" - } - ], - "description": ["This is section 3."], - "id": "section-3-question", - "title": "Which section is this?", - "type": "General" - } - } - ], - "id": "section-3-group", - "title": "Section 3" - } - ] - } - ] -} diff --git a/schemas/test/en/test_section_enabled_radio.json b/schemas/test/en/test_section_enabled_radio.json deleted file mode 100644 index 3141ae569f..0000000000 --- a/schemas/test/en/test_section_enabled_radio.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Section Enabled", - "theme": "default", - "description": "A questionnaire to demo section enabled key usage with radio options", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section-1", - "title": "Section 1", - "groups": [ - { - "blocks": [ - { - "id": "section-1-block", - "type": "Question", - "question": { - "answers": [ - { - "id": "section-1-answer", - "label": "Section 1", - "mandatory": false, - "options": [ - { - "label": "Yes, enable section 2", - "value": "Yes, enable section 2" - }, - { - "label": "No, disable section 2", - "value": "No, disable section 2" - } - ], - "type": "Radio" - } - ], - "description": ["This is section 1."], - "id": "section-1-question", - "title": "Do you want to enable section 2?", - "type": "General" - } - } - ], - "id": "section-1-group", - "title": "Section 1" - } - ] - }, - { - "id": "section-2", - "title": "Section 2", - "enabled": { - "when": { - "==": [ - "Yes, enable section 2", - { - "source": "answers", - "identifier": "section-1-answer" - } - ] - } - }, - "groups": [ - { - "blocks": [ - { - "id": "section-2-block", - "type": "Question", - "question": { - "answers": [ - { - "id": "section-2-answer", - "label": "Section 2", - "mandatory": false, - "type": "Number" - } - ], - "description": ["This is section 2."], - "id": "section-2-question", - "title": "Which section is this?", - "type": "General" - } - } - ], - "id": "section-2-group", - "title": "Section 2" - } - ] - } - ] -} diff --git a/schemas/test/en/test_section_summary.json b/schemas/test/en/test_section_summary.json deleted file mode 100644 index 53b66398b3..0000000000 --- a/schemas/test/en/test_section_summary.json +++ /dev/null @@ -1,284 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "999", - "title": "Section Summary", - "description": "A questionnaire to test section summaries", - "theme": "default", - "navigation": { - "visible": true - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": true - } - } - }, - "sections": [ - { - "id": "property-details-section", - "title": "Property Details Section", - "summary": { - "page_title": "Custom section summary title", - "show_on_completion": true - }, - "groups": [ - { - "id": "property-details", - "title": "Property Details", - "blocks": [ - { - "id": "insurance-type", - "type": "Question", - "question": { - "id": "insurance-type-question", - "title": "What kind of insurance would you like?", - "type": "General", - "answers": [ - { - "id": "insurance-type-answer", - "type": "Radio", - "mandatory": false, - "options": [ - { - "label": "Buildings", - "value": "Buildings" - }, - { - "label": "Contents", - "value": "Contents" - }, - { - "label": "Both", - "value": "Both" - } - ] - } - ] - } - }, - { - "id": "insurance-address", - "type": "Question", - "question": { - "id": "insurance-address-question", - "title": "What is the address you would like to insure?", - "type": "General", - "answers": [ - { - "id": "insurance-address-answer", - "type": "TextArea", - "mandatory": false - } - ] - } - } - ] - }, - { - "id": "address-length", - "title": "Address Duration", - "blocks": [ - { - "id": "address-duration", - "type": "Question", - "question": { - "id": "address-duration-question", - "title": "Have you been living at this address for over 5 years?", - "type": "General", - "answers": [ - { - "id": "address-duration-answer", - "type": "Radio", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "skip_conditions": { - "when": { - "==": [ - { - "source": "answers", - "identifier": "insurance-type-answer" - }, - "Both" - ] - } - } - } - ] - }, - { - "id": "address-listed", - "title": "Listed Status", - "blocks": [ - { - "id": "listed", - "type": "Question", - "question": { - "id": "listed-question", - "title": "Does this address have Listed status?", - "type": "General", - "answers": [ - { - "id": "listed-answer", - "type": "Radio", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "house-details-section", - "title": "House Details Section", - "summary": { - "show_on_completion": true, - "title": { - "text": "Household Summary - {house_type_answer}", - "placeholders": [ - { - "placeholder": "house_type_answer", - "value": { - "source": "answers", - "identifier": "house-type-answer" - } - } - ] - } - }, - "groups": [ - { - "id": "house-details", - "title": "House Details", - "blocks": [ - { - "id": "house-type", - "type": "Question", - "question": { - "id": "house-type-question", - "title": "What kind of house is it?", - "type": "General", - "answers": [ - { - "id": "house-type-answer", - "type": "Radio", - "mandatory": false, - "options": [ - { - "label": "Detached", - "value": "Detached" - }, - { - "label": "Semi-detached", - "value": "Semi-detached" - }, - { - "label": "Terrace", - "value": "Terrace" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "household-count-section", - "title": "Household member count", - "summary": { - "show_on_completion": true, - "title": { - "text_plural": { - "forms": { - "one": "{number_of_people} person lives here", - "other": "{number_of_people} people live here" - }, - "count": { - "source": "answers", - "identifier": "number-of-people-answer" - } - }, - "placeholders": [ - { - "placeholder": "number_of_people", - "value": { - "source": "answers", - "identifier": "number-of-people-answer" - } - } - ] - } - }, - "groups": [ - { - "id": "number-of-people-group", - "title": "Number of people", - "blocks": [ - { - "type": "Question", - "id": "number-of-people", - "question": { - "answers": [ - { - "id": "number-of-people-answer", - "label": "Number of people", - "mandatory": true, - "type": "Number" - } - ], - "id": "number-of-people-question", - "title": "Title", - "type": "General" - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_show_section_summary_on_completion.json b/schemas/test/en/test_show_section_summary_on_completion.json deleted file mode 100644 index 25317ebfc0..0000000000 --- a/schemas/test/en/test_show_section_summary_on_completion.json +++ /dev/null @@ -1,201 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Show summary on section completion", - "theme": "default", - "description": "A questionnaire to demo the `show_on_completion` functionality", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { - "required_completed_sections": ["employment-section"] - } - }, - "sections": [ - { - "id": "employment-section", - "title": "Employment", - "summary": { - "show_on_completion": false - }, - "groups": [ - { - "id": "radio", - "title": "Radio Optional", - "blocks": [ - { - "type": "Question", - "id": "employment-status", - "question": { - "answers": [ - { - "id": "employment-status-answer", - "mandatory": false, - "options": [ - { - "label": "Working as an employee", - "value": "Working as an employee" - }, - { - "label": "Self-employed or freelance", - "value": "Self-employed or freelance" - }, - { - "label": "Temporarily away from work ill, on holiday or temporarily laid off", - "value": "Temporarily away from work ill, on holiday or temporarily laid off" - }, - { - "label": "On maternity or paternity leave", - "value": "On maternity or paternity leave" - }, - { - "label": "Doing any other kind of paid work", - "value": "Doing any other kind of paid work" - } - ], - "type": "Checkbox" - }, - { - "id": "employment-status-answer-exclusive", - "mandatory": false, - "options": [ - { - "label": "None of these apply", - "value": "None of these apply" - } - ], - "type": "Checkbox" - } - ], - "guidance": { - "contents": [ - { - "description": "Include casual or temporary work, even if only for one hour" - } - ] - }, - "id": "employment-status-question", - "mandatory": true, - "title": "In the last seven days, were you doing any of the following?", - "type": "MutuallyExclusive" - }, - "routing_rules": [ - { - "block": "employment-type", - "when": { - "==": [ - { - "identifier": "employment-status-answer", - "source": "answers" - }, - null - ] - } - }, - { - "group": "checkboxes" - } - ] - }, - { - "type": "Question", - "id": "employment-type", - "question": { - "answers": [ - { - "id": "employment-type-answer", - "mandatory": false, - "options": [ - { - "description": "Whether receiving a pension or not", - "label": "Retired", - "value": "Retired" - }, - { - "label": "Studying", - "value": "Studying" - }, - { - "label": "Looking after home or family", - "value": "Looking after home or family" - }, - { - "label": "Long-term sick or disabled", - "value": "Long-term sick or disabled" - }, - { - "label": "Other", - "value": "Other" - } - ], - "type": "Checkbox" - } - ], - "id": "employment-type-question", - "title": "Which of the following describes what you were doing in the last seven days?", - "type": "General" - } - } - ] - } - ] - }, - { - "id": "accommodation-section", - "title": "Accommodation", - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "blocks": [ - { - "id": "proxy", - "question": { - "answers": [ - { - "default": "Yes", - "id": "proxy-answer", - "mandatory": false, - "options": [ - { - "label": "No, I’m answering for myself", - "value": "No, I’m answering for myself" - }, - { - "label": "Yes", - "value": "Yes" - } - ], - "type": "Radio" - } - ], - "id": "proxy-question", - "title": "Are you answering the questions on behalf of someone else?", - "type": "General" - }, - "type": "Question" - } - ], - "id": "checkboxes" - } - ] - } - ] -} diff --git a/schemas/test/en/test_skip_condition_answer_comparison.json b/schemas/test/en/test_skip_condition_answer_comparison.json deleted file mode 100644 index b55936ef26..0000000000 --- a/schemas/test/en/test_skip_condition_answer_comparison.json +++ /dev/null @@ -1,157 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Routing Answer Comparisons", - "theme": "default", - "legal_basis": "StatisticsOfTradeAct", - "description": "A test survey for routing based comparison with answers", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "comparison-1", - "question": { - "answers": [ - { - "id": "comparison-1-answer", - "label": "1st Number", - "mandatory": true, - "type": "Number" - } - ], - "id": "comparison-1-question", - "title": "Enter your first number", - "type": "General" - } - }, - { - "type": "Question", - "id": "comparison-2", - "question": { - "answers": [ - { - "id": "comparison-2-answer", - "label": "2nd Number", - "mandatory": true, - "type": "Number" - } - ], - "id": "comparison-2-question", - "title": "Enter your second number", - "type": "General" - } - }, - { - "type": "Interstitial", - "id": "equals-answers", - "content": { - "title": "Answers equal", - "contents": [ - { - "description": "Your second number was equal to your first number" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [ - { - "identifier": "comparison-1-answer", - "source": "answers" - }, - { - "source": "answers", - "identifier": "comparison-2-answer" - } - ] - } - } - }, - { - "type": "Interstitial", - "id": "less-than-answers", - "content": { - "title": "First less than second", - "contents": [ - { - "description": "Your first answer was less than your second number" - } - ] - }, - "skip_conditions": { - "when": { - ">=": [ - { - "identifier": "comparison-1-answer", - "source": "answers" - }, - { - "identifier": "comparison-2-answer", - "source": "answers" - } - ] - } - } - }, - { - "type": "Interstitial", - "id": "greater-than-answers", - "content": { - "title": "First greater than second", - "contents": [ - { - "description": "Your first answer was greater than your second number" - } - ] - }, - "skip_conditions": { - "when": { - "<=": [ - { - "identifier": "comparison-1-answer", - "source": "answers" - }, - { - "source": "answers", - "identifier": "comparison-2-answer" - } - ] - } - } - } - ], - "id": "skip-group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_skip_condition_block.json b/schemas/test/en/test_skip_condition_block.json deleted file mode 100644 index 389aa2095e..0000000000 --- a/schemas/test/en/test_skip_condition_block.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Skip block", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "default-group", - "title": "Group 1", - "blocks": [ - { - "type": "Question", - "id": "do-you-want-to-skip", - "question": { - "id": "do-you-want-to-skip-question", - "title": "Do you want to skip the next question?", - "type": "General", - "description": ["Select “Yes” to skip the next question and go straight to the summary"], - "answers": [ - { - "id": "do-you-want-to-skip-answer", - "label": "Select an answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ] - } - }, - { - "type": "Question", - "id": "should-skip", - "question": { - "id": "should-skip-question", - "title": "Why didn’t you skip the block?", - "type": "General", - "answers": [ - { - "id": "should-skip-answer", - "label": "Enter your answer", - "mandatory": true, - "type": "TextArea" - } - ] - }, - "skip_conditions": { - "when": { - "==": [ - { - "source": "answers", - "identifier": "do-you-want-to-skip-answer" - }, - "Yes" - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_skip_condition_group.json b/schemas/test/en/test_skip_condition_group.json deleted file mode 100644 index 1640b7ee88..0000000000 --- a/schemas/test/en/test_skip_condition_group.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Skip group", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "default-group", - "title": "Group 1", - "blocks": [ - { - "type": "Question", - "id": "do-you-want-to-skip", - "question": { - "id": "do-you-want-to-skip-question", - "title": "Do you want to skip the next question?", - "type": "General", - "description": ["Select “Yes” to skip the next question and go straight to the summary"], - "answers": [ - { - "id": "do-you-want-to-skip-answer", - "label": "Select an answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ] - } - } - ] - }, - { - "id": "should-skip-group", - "title": "Group 2 (Skippable)", - "skip_conditions": { - "when": { - "==": [ - { - "source": "answers", - "identifier": "do-you-want-to-skip-answer" - }, - "Yes" - ] - } - }, - "blocks": [ - { - "type": "Question", - "id": "should-skip", - "question": { - "id": "should-skip-question", - "title": "Why didn’t you skip the group?", - "type": "General", - "answers": [ - { - "id": "should-skip-answer", - "label": "Enter your answer", - "mandatory": true, - "type": "TextArea" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_skip_condition_list.json b/schemas/test/en/test_skip_condition_list.json deleted file mode 100644 index 4061083936..0000000000 --- a/schemas/test/en/test_skip_condition_list.json +++ /dev/null @@ -1,272 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test List Skip Conditions", - "theme": "default", - "description": "A questionnaire to test list skip conditions", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": "Household members", - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "id": "more-than-two-interstitial", - "content": { - "title": "Skippable page - More than two people", - "contents": [ - { - "description": "This page is only displayed when there are more than two people in the list" - } - ] - }, - "skip_conditions": { - "when": { - "<": [ - { - "count": [ - { - "source": "list", - "identifier": "people" - } - ] - }, - 3 - ] - } - }, - "type": "Interstitial" - }, - { - "id": "two-interstitial", - "content": { - "title": "Skippable page - Two people", - "contents": [ - { - "description": "This page is only displayed when there are two people in the list" - } - ] - }, - "skip_conditions": { - "when": { - "!=": [ - { - "count": [ - { - "source": "list", - "identifier": "people" - } - ] - }, - 2 - ] - } - }, - "type": "Interstitial" - }, - { - "id": "less-than-two-interstitial", - "content": { - "title": "Skippable page - Less than two people", - "contents": [ - { - "description": "This page is only displayed when there are less than two people in the list" - } - ] - }, - "skip_conditions": { - "when": { - ">": [ - { - "count": [ - { - "source": "list", - "identifier": "people" - } - ] - }, - 1 - ] - } - }, - "type": "Interstitial" - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_skip_condition_not_set.json b/schemas/test/en/test_skip_condition_not_set.json deleted file mode 100644 index 80a871d6dd..0000000000 --- a/schemas/test/en/test_skip_condition_not_set.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test not set skip condition", - "theme": "default", - "description": "A questionnaire to test skip condition not set.", - "messages": {}, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "food-block", - "question": { - "answers": [ - { - "id": "food-answer", - "label": "What is your favourite breakfast food", - "mandatory": false, - "options": [ - { - "label": "Bacon", - "value": "Bacon" - }, - { - "label": "Eggs", - "value": "Eggs" - } - ], - "type": "Radio" - } - ], - "id": "food-question", - "title": "Title", - "type": "General" - } - }, - { - "type": "Question", - "id": "drink-block", - "question": { - "answers": [ - { - "id": "drink-answer", - "label": "What is your favourite breakfast beverage", - "mandatory": false, - "options": [ - { - "label": "Tea", - "value": "Tea" - }, - { - "label": "Coffee", - "value": "Coffee" - } - ], - "type": "Radio" - } - ], - "id": "drink-section", - "title": "What beverage would you like to accompany your choice of breakfast?", - "type": "General" - }, - "skip_conditions": { - "when": { - "==": [ - { - "identifier": "food-answer", - "source": "answers" - }, - null - ] - } - } - } - ], - "id": "breakfast" - } - ] - } - ] -} diff --git a/schemas/test/en/test_skip_condition_set.json b/schemas/test/en/test_skip_condition_set.json deleted file mode 100644 index 993fb59e34..0000000000 --- a/schemas/test/en/test_skip_condition_set.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test set skip condition", - "theme": "default", - "description": "A questionnaire to test skip condition set.", - "messages": {}, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "food-block", - "question": { - "answers": [ - { - "id": "food-answer", - "label": "What is your favourite breakfast food", - "mandatory": false, - "options": [ - { - "label": "Bacon", - "value": "Bacon" - }, - { - "label": "Eggs", - "value": "Eggs" - } - ], - "type": "Radio" - } - ], - "id": "food-question", - "title": "Title", - "type": "General" - } - }, - { - "type": "Question", - "id": "drink-block", - "question": { - "answers": [ - { - "id": "drink-answer", - "label": "What is your favourite breakfast beverage", - "mandatory": false, - "options": [ - { - "label": "Tea", - "value": "Tea" - }, - { - "label": "Coffee", - "value": "Coffee" - } - ], - "type": "Radio" - } - ], - "id": "drink-section", - "title": "What beverage would you like to accompany your choice of breakfast?", - "type": "General" - }, - "skip_conditions": { - "when": { - "!=": [ - { - "identifier": "food-answer", - "source": "answers" - }, - null - ] - } - } - } - ], - "id": "breakfast" - } - ] - } - ] -} diff --git a/schemas/test/en/test_submit_with_custom_submission_text.json b/schemas/test/en/test_submit_with_custom_submission_text.json deleted file mode 100644 index e4401d211c..0000000000 --- a/schemas/test/en/test_submit_with_custom_submission_text.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Submit without summary", - "theme": "default", - "description": "A questionnaire to demo submit without summary.", - "navigation": { - "visible": true - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": {} - }, - "submission": { - "button": "Submit", - "guidance": "Thank you for your answers, submit this to complete it", - "title": "Submit your questionnaire", - "warning": "You cannot view your answers after submission" - }, - "sections": [ - { - "id": "first-group", - "title": "First group", - "groups": [ - { - "blocks": [ - { - "type": "Introduction", - "id": "introduction" - }, - { - "type": "Question", - "id": "breakfast", - "question": { - "answers": [ - { - "id": "breakfast-answer", - "label": "What is your favourite breakfast food", - "mandatory": false, - "type": "TextField" - } - ], - "id": "breakfast-question", - "title": "What is your favourite breakfast food", - "type": "General" - } - } - ], - "id": "final-confirmation", - "title": "First group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_submit_with_summary.json b/schemas/test/en/test_submit_with_summary.json deleted file mode 100644 index 3a8a3af974..0000000000 --- a/schemas/test/en/test_submit_with_summary.json +++ /dev/null @@ -1,191 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Other input fields", - "theme": "default", - "description": "A questionnaire to demo radio field Other input.", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "title": "test", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "radio", - "question": { - "answers": [ - { - "id": "radio-answer", - "mandatory": false, - "options": [ - { - "label": "None", - "value": "None" - }, - { - "label": "Bacon", - "value": "Bacon" - }, - { - "label": "Eggs", - "value": "Eggs" - }, - { - "label": "Sausage", - "value": "Sausage" - }, - { - "label": "Other", - "value": "Other", - "description": "An answer is required", - "detail_answer": { - "mandatory": false, - "id": "radio-answer-other", - "label": "Please specify other", - "type": "TextField" - } - } - ], - "type": "Radio" - } - ], - "id": "radio-question", - "title": "What is your favourite breakfast food?", - "type": "General" - } - } - ], - "id": "radio-group" - }, - { - "blocks": [ - { - "type": "Question", - "id": "dessert", - "question": { - "id": "dessert-question", - "title": "What is your favourite dessert?", - "type": "General", - "answers": [ - { - "id": "dessert-answer", - "label": "Dessert", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - { - "type": "Question", - "id": "dessert-confirmation", - "question": { - "id": "test-dessert-confirmation-question", - "title": { - "text": "Are you sure {dessert} is your favourite?", - "placeholders": [ - { - "placeholder": "dessert", - "value": { - "source": "answers", - "identifier": "dessert-answer" - } - } - ] - }, - "type": "General", - "answers": [ - { - "id": "dessert-confirmation-answer", - "label": "Radio", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - } - ], - "id": "dessert-group", - "title": "Dessert" - }, - { - "blocks": [ - { - "type": "Question", - "id": "numbers", - "question": { - "answers": [ - { - "id": "numbers-currency-answer", - "label": "Currency", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "numbers-unit-answer", - "label": "Kilometres Square", - "mandatory": false, - "type": "Unit", - "unit_length": "short", - "unit": "area-square-kilometer" - }, - { - "id": "numbers-decimal-answer", - "label": "Decimal (to 2 decimal places)", - "mandatory": false, - "type": "Number", - "decimal_places": 2 - } - ], - "id": "numbers-question", - "title": "What are the test values?", - "type": "General" - } - } - ], - "id": "numbers-group", - "title": "Numbers" - } - ] - } - ] -} diff --git a/schemas/test/en/test_submit_with_summary_custom_submission_text.json b/schemas/test/en/test_submit_with_summary_custom_submission_text.json deleted file mode 100644 index 07943d2b69..0000000000 --- a/schemas/test/en/test_submit_with_summary_custom_submission_text.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Other input fields", - "theme": "default", - "description": "Test a Summary page with submission content set", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "submission": { - "button": "Submission button", - "guidance": "Submission guidance", - "title": "Submission title", - "warning": "Submission warning" - }, - "sections": [ - { - "id": "default-section", - "title": "test", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "dessert-block", - "question": { - "id": "test-dessert-question", - "title": "What is your favourite dessert?", - "type": "General", - "answers": [ - { - "id": "dessert", - "label": "What is your favourite dessert?", - "mandatory": true, - "type": "TextField" - } - ] - } - } - ], - "id": "dessert-group", - "title": "Dessert" - } - ] - } - ] -} diff --git a/schemas/test/en/test_submit_with_summary_return_to_answer.json b/schemas/test/en/test_submit_with_summary_return_to_answer.json deleted file mode 100644 index 77d83caae0..0000000000 --- a/schemas/test/en/test_submit_with_summary_return_to_answer.json +++ /dev/null @@ -1,233 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "999", - "title": "Section summary with return to answer", - "description": "A questionnaire to test scrolling to answers on summary page", - "theme": "default", - "navigation": { - "visible": true - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": true - } - } - }, - "sections": [ - { - "id": "property-details-section", - "title": "Property Details Section", - "summary": { - "page_title": "Custom section summary title", - "show_on_completion": true - }, - "groups": [ - { - "id": "name-details", - "title": "Name Details", - "blocks": [ - { - "type": "Question", - "id": "name", - "question": { - "id": "name-question", - "title": "Name", - "type": "General", - "summary": { - "concatenation_type": "Space" - }, - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": false, - "type": "TextField" - }, - { - "id": "middle-name", - "label": "Middle name", - "mandatory": false, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": false, - "type": "TextField" - } - ] - } - } - ] - }, - { - "id": "property-details", - "title": "Property Details", - "blocks": [ - { - "id": "insurance-type", - "type": "Question", - "question": { - "id": "insurance-type-question", - "title": "What kind of insurance would you like?", - "type": "General", - "answers": [ - { - "id": "insurance-type-answer", - "type": "Radio", - "mandatory": false, - "options": [ - { - "label": "Buildings", - "value": "Buildings" - }, - { - "label": "Contents", - "value": "Contents" - }, - { - "label": "Both", - "value": "Both" - } - ] - } - ] - } - }, - { - "id": "insurance-address", - "type": "Question", - "question": { - "id": "insurance-address-question", - "title": "What are the addresses you would like to insure?", - "type": "General", - "answers": [ - { - "id": "insurance-address-answer1", - "type": "TextArea", - "mandatory": false, - "label": "Insurance address answer 1" - }, - { - "id": "insurance-address-answer2", - "type": "TextArea", - "mandatory": false, - "label": "Insurance address answer 2" - } - ] - } - } - ] - }, - { - "id": "address-length", - "title": "Address Duration", - "blocks": [ - { - "id": "address-duration", - "type": "Question", - "question": { - "id": "address-duration-question", - "title": "Have you been living at this address for over 5 years?", - "type": "General", - "answers": [ - { - "id": "address-duration-answer", - "type": "Radio", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "house-details-section", - "title": "House Details Section", - "summary": { - "show_on_completion": true, - "title": { - "text": "Household Summary - {house_type_answer}", - "placeholders": [ - { - "placeholder": "house_type_answer", - "value": { - "source": "answers", - "identifier": "house-type-answer" - } - } - ] - } - }, - "groups": [ - { - "id": "house-details", - "title": "House Details", - "blocks": [ - { - "id": "house-type", - "type": "Question", - "question": { - "id": "house-type-question", - "title": "What kind of house is it?", - "type": "General", - "answers": [ - { - "id": "house-type-answer", - "type": "Radio", - "mandatory": false, - "options": [ - { - "label": "Detached", - "value": "Detached" - }, - { - "label": "Semi-detached", - "value": "Semi-detached" - }, - { - "label": "Terrace", - "value": "Terrace" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_supplementary_data.json b/schemas/test/en/test_supplementary_data.json deleted file mode 100644 index 8b541a4e09..0000000000 --- a/schemas/test/en/test_supplementary_data.json +++ /dev/null @@ -1,1950 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "123", - "title": "Test Supplementary Data", - "theme": "default", - "description": "A questionnaire to demo using Supplementary data for placeholders, validation and routing in both repeating and non repeating sections.", - "metadata": [ - { - "name": "survey_id", - "type": "string" - }, - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - }, - { - "name": "sds_dataset_id", - "type": "string" - } - ], - "supplementary_data": { - "lists": ["employees", "products"] - }, - "questionnaire_flow": { - "type": "Hub", - "options": { - "required_completed_sections": ["introduction-section"] - } - }, - "post_submission": { - "view_response": true - }, - "sections": [ - { - "id": "introduction-section", - "title": "Introduction", - "groups": [ - { - "id": "introduction-group", - "title": "Introduction Group", - "blocks": [ - { - "id": "loaded-successfully-block", - "type": "Interstitial", - "content": { - "title": "Supplementary Data", - "contents": [ - { - "title": "You have successfully loaded Supplementary data", - "description": { - "text": "List of products: {products}", - "placeholders": [ - { - "placeholder": "products", - "transforms": [ - { - "transform": "format_list", - "arguments": { - "list_to_format": { - "source": "supplementary_data", - "identifier": "products", - "selectors": ["name"] - } - } - } - ] - } - ] - }, - "guidance": { - "contents": [ - { - "description": { - "text": "The purpose of this block, is to test that supplementary data loads successfully, separate to using the supplementary data. The surnames of the employees are: {surnames}.", - "placeholders": [ - { - "placeholder": "surnames", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "supplementary_data", - "identifier": "employees", - "selectors": ["personal_details", "surname"] - } - ], - "delimiter": ", " - } - } - ] - } - ] - } - } - ] - } - } - ] - } - }, - { - "id": "introduction-block", - "type": "Introduction", - "primary_content": [ - { - "id": "business-details", - "title": { - "text": "You are completing this survey for {company_name}", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "supplementary_data", - "identifier": "company_name" - } - } - ] - }, - "contents": [ - { - "description": { - "text": "If the company details or structure have changed contact us on {telephone_number_link}", - "placeholders": [ - { - "placeholder": "telephone_number_link", - "value": { - "source": "supplementary_data", - "identifier": "company_details", - "selectors": ["telephone_number"] - } - } - ] - } - }, - { - "guidance": { - "contents": [ - { - "title": "Guidance for completing this survey", - "list": [ - "The company name, telephone number all come from supplementary data", - "if you picked the supplementary dataset with guidance, there will be a 3rd bullet point below this one, with the supplementary guidance.", - { - "text": "{survey_guidance}", - "placeholders": [ - { - "placeholder": "survey_guidance", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "supplementary_data", - "identifier": "guidance" - } - ] - } - } - ] - } - ] - } - ] - } - ] - } - } - ] - } - ] - } - ] - } - ] - }, - { - "id": "section-1", - "title": "Company Details", - "summary": { - "page_title": "Summary title", - "show_on_completion": true - }, - "groups": [ - { - "id": "introduction", - "title": "Group 1", - "blocks": [ - { - "id": "email-block", - "type": "Question", - "question": { - "id": "email-question", - "type": "General", - "guidance": { - "contents": [ - { - "description": "If you answer no, an additional block will open up allowing entering of a different email" - } - ] - }, - "title": { - "text": "Is {email} still the correct contact email for {company_name}?", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "supplementary_data", - "identifier": "company_name" - } - }, - { - "placeholder": "email", - "value": { - "source": "supplementary_data", - "identifier": "company_details", - "selectors": ["email"] - } - } - ] - }, - "answers": [ - { - "id": "same-email-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - { - "skip_conditions": { - "when": { - "==": [ - { - "source": "answers", - "identifier": "same-email-answer" - }, - "Yes" - ] - } - }, - "type": "Question", - "id": "new-email", - "question": { - "id": "new-email-question", - "type": "General", - "title": { - "text": "What is the new contact email for {company_name}?", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "supplementary_data", - "identifier": "company_name" - } - } - ] - }, - "answers": [ - { - "id": "new-email-answer", - "label": "Contact email", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - { - "type": "Question", - "id": "trading", - "question": { - "id": "trading-question", - "type": "General", - "title": { - "text": "When did {company_name} begin trading?", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "supplementary_data", - "identifier": "company_name" - } - } - ] - }, - "answers": [ - { - "id": "trading-answer", - "label": "Date commenced", - "mandatory": true, - "type": "Radio", - "dynamic_options": { - "values": { - "map": [ - { - "format-date": ["self", "yyyy-MM-dd"] - }, - { - "date-range": [ - { - "date": [ - { - "source": "supplementary_data", - "identifier": "incorporation_date" - } - ] - }, - 7 - ] - } - ] - }, - "transform": { - "format-date": [ - { - "date": ["self"] - }, - "EEEE d MMMM yyyy" - ] - } - } - } - ] - } - }, - { - "type": "Question", - "id": "sales-breakdown-block", - "question": { - "id": "sales-breakdown-question", - "title": { - "text": "How much of the {sales} total UK sales was from Bristol and London?", - "placeholders": [ - { - "placeholder": "sales", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "source": "supplementary_data", - "identifier": "total_uk_sales" - } - } - } - ] - } - ] - }, - "type": "Calculated", - "warning": "These answers must not exceed the reported total from the supplementary data", - "calculations": [ - { - "calculation_type": "sum", - "value": { - "source": "supplementary_data", - "identifier": "total_uk_sales" - }, - "answers_to_calculate": ["sales-bristol-answer", "sales-london-answer"], - "conditions": ["less than", "equals"] - } - ], - "answers": [ - { - "id": "sales-bristol-answer", - "label": "Bristol Sales", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "sales-london-answer", - "label": "London Sales", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-sales", - "title": "Total value of sales from Bristol and London is calculated to be %(total)s. Is this correct?", - "calculation": { - "title": "Total sales", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "sales-london-answer" - }, - { - "source": "answers", - "identifier": "sales-bristol-answer" - } - ] - } - } - }, - { - "id": "section-1-interstitial", - "type": "Interstitial", - "content": { - "title": { - "text": "Summary of information provided for {company_name}", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "supplementary_data", - "identifier": "company_name" - } - } - ] - }, - "contents": [ - { - "list": [ - { - "text": "Telephone Number: {phone}", - "placeholders": [ - { - "placeholder": "phone", - "value": { - "source": "supplementary_data", - "identifier": "company_details", - "selectors": ["telephone_number"] - } - } - ] - }, - { - "text": "Email: {company_email}", - "placeholders": [ - { - "placeholder": "company_email", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "answers", - "identifier": "new-email-answer" - }, - { - "source": "supplementary_data", - "identifier": "company_details", - "selectors": ["email"] - } - ] - } - } - ] - } - ] - }, - { - "text": "Note Title: {note_title}", - "placeholders": [ - { - "placeholder": "note_title", - "value": { - "source": "supplementary_data", - "identifier": "note", - "selectors": ["title"] - } - } - ] - }, - { - "text": "Note Description: {note_description}", - "placeholders": [ - { - "placeholder": "note_description", - "value": { - "source": "supplementary_data", - "identifier": "note", - "selectors": ["description"] - } - } - ] - }, - { - "text": "Note Example Title: {note_title}", - "placeholders": [ - { - "placeholder": "note_title", - "value": { - "source": "supplementary_data", - "identifier": "note", - "selectors": ["example", "title"] - } - } - ] - }, - { - "text": "Note Example Description: {note_description}", - "placeholders": [ - { - "placeholder": "note_description", - "value": { - "source": "supplementary_data", - "identifier": "note", - "selectors": ["example", "description"] - } - } - ] - }, - { - "text": "Incorporation Date: {incorporation_date}", - "placeholders": [ - { - "placeholder": "incorporation_date", - "transforms": [ - { - "arguments": { - "date_format": "d MMMM yyyy", - "date_to_format": { - "source": "supplementary_data", - "identifier": "incorporation_date" - } - }, - "transform": "format_date" - } - ] - } - ] - }, - { - "text": "Trading start date: {trading_date}", - "placeholders": [ - { - "placeholder": "trading_date", - "transforms": [ - { - "arguments": { - "date_format": "d MMMM yyyy", - "date_to_format": { - "source": "answers", - "identifier": "trading-answer" - } - }, - "transform": "format_date" - } - ] - } - ] - }, - { - "text": "Guidance: {guidance}", - "placeholders": [ - { - "placeholder": "guidance", - "value": { - "source": "supplementary_data", - "identifier": "guidance" - } - } - ] - }, - { - "text": "Total Uk Sales: {sales}", - "placeholders": [ - { - "placeholder": "sales", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "source": "supplementary_data", - "identifier": "total_uk_sales" - } - } - } - ] - } - ] - }, - { - "text": "Bristol sales: {bristol_sales}", - "placeholders": [ - { - "placeholder": "bristol_sales", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "source": "answers", - "identifier": "sales-bristol-answer" - } - } - } - ] - } - ] - }, - { - "text": "London sales: {london_sales}", - "placeholders": [ - { - "placeholder": "london_sales", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "source": "answers", - "identifier": "sales-london-answer" - } - } - } - ] - } - ] - }, - { - "text": "Sum of Bristol and London sales: {total_sales}", - "placeholders": [ - { - "placeholder": "total_sales", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "source": "calculated_summary", - "identifier": "calculated-summary-sales" - } - } - } - ] - } - ] - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "section-2", - "title": "Employees", - "groups": [ - { - "id": "employee-reporting", - "blocks": [ - { - "id": "list-collector-employees", - "type": "ListCollectorContent", - "page_title": "Employees", - "for_list": "employees", - "content": { - "title": "Employees", - "contents": [ - { - "definition": { - "title": "Company employees", - "contents": [ - { - "description": "List of previously reported employees." - } - ] - } - }, - { - "description": "You have previously reported on the above employees. Press continue to proceed to the next section where you can add any additional employees." - } - ] - }, - "summary": { - "title": "employees", - "item_title": { - "text": "{employee_name}", - "placeholders": [ - { - "placeholder": "employee_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "supplementary_data", - "identifier": "employees", - "selectors": ["personal_details", "forename"] - }, - { - "source": "supplementary_data", - "identifier": "employees", - "selectors": ["personal_details", "surname"] - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "section-3", - "title": "Additional Employees", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "additional-employees", - "title": "employees", - "add_link_text": "Add another employee", - "empty_list_text": "There are no employees" - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "additional-employee-reporting", - "blocks": [ - { - "type": "ListCollectorDrivingQuestion", - "id": "any-additional-employees", - "for_list": "additional-employees", - "question": { - "type": "General", - "id": "any-additional-employee-question", - "title": "Do you have any additional employees to report on?", - "guidance": { - "contents": [ - { - "description": "This uses a different employees list, and the items from this list and the supplementary list will then be used in repeating sections" - } - ] - }, - "answers": [ - { - "type": "Radio", - "id": "any-additional-employee-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-additional-employee", - "list_name": "additional-employees" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "section": "End", - "when": { - "==": [ - { - "source": "answers", - "identifier": "any-additional-employee-answer" - }, - "No" - ] - } - }, - { - "block": "list-collector-additional" - } - ] - }, - { - "id": "list-collector-additional", - "type": "ListCollector", - "for_list": "additional-employees", - "question": { - "id": "confirmation-additional-question", - "type": "General", - "title": "Do you need to add any more employees?", - "answers": [ - { - "id": "list-collector-additional-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-additional-employee", - "type": "ListAddQuestion", - "cancel_text": "Don’t need to add any other employees?", - "question": { - "id": "add-additional-question", - "type": "General", - "title": "What is the name of the employee?", - "answers": [ - { - "id": "employee-first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "employee-last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-additional-employee", - "type": "ListEditQuestion", - "cancel_text": "Don’t need to change anything?", - "question": { - "id": "edit-additional-question", - "type": "General", - "title": "What is the name of the employee?", - "answers": [ - { - "id": "employee-first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "employee-last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-additional-employee", - "type": "ListRemoveQuestion", - "cancel_text": "Don’t need to remove this employee?", - "question": { - "id": "remove-additional-question", - "type": "General", - "title": "Are you sure you want to remove this employee?", - "warning": "All of the information about this employee will be deleted", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "employees", - "item_title": { - "text": "{employee_name}", - "placeholders": [ - { - "placeholder": "employee_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "employee-first-name" - }, - { - "source": "answers", - "identifier": "employee-last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "enabled": { - "when": { - "and": [ - { - "==": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-2" - }, - "COMPLETED" - ] - }, - { - "==": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-3" - }, - "COMPLETED" - ] - } - ] - } - }, - "id": "section-4", - "title": "Employee Details", - "summary": { - "show_on_completion": true - }, - "repeat": { - "for_list": "employees", - "title": { - "text": "{employee_name}", - "placeholders": [ - { - "placeholder": "employee_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "supplementary_data", - "identifier": "employees", - "selectors": ["personal_details", "forename"] - }, - { - "source": "supplementary_data", - "identifier": "employees", - "selectors": ["personal_details", "surname"] - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - }, - "groups": [ - { - "id": "employee-detail-questions", - "blocks": [ - { - "type": "Question", - "id": "length-of-employment", - "question": { - "id": "length-employment-question", - "type": "General", - "title": { - "text": "When did {employee_name} start working for {company_name}?", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "supplementary_data", - "identifier": "company_name" - } - }, - { - "placeholder": "employee_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "supplementary_data", - "identifier": "employees", - "selectors": ["personal_details", "forename"] - }, - { - "source": "supplementary_data", - "identifier": "employees", - "selectors": ["personal_details", "surname"] - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - }, - "answers": [ - { - "id": "employment-start", - "label": { - "text": "Start date at {company_name}", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "supplementary_data", - "identifier": "company_name" - } - } - ] - }, - "mandatory": true, - "type": "Date", - "maximum": { - "value": "now" - }, - "minimum": { - "value": { - "source": "supplementary_data", - "identifier": "incorporation_date" - } - } - } - ] - } - }, - { - "id": "conditional-employee-block", - "type": "Question", - "skip_conditions": { - "when": { - "!=": [ - { - "count": [ - { - "source": "list", - "identifier": "employees" - } - ] - }, - 3 - ] - } - }, - "question": { - "id": "conditional-employee-question", - "guidance": { - "contents": [ - { - "description": "This block is enabled because there are 3 employees in the supplementary dataset" - } - ] - }, - "type": "General", - "title": { - "text": "Has {employee_name} been promoted since starting at {company_name}?", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "supplementary_data", - "identifier": "company_name" - } - }, - { - "placeholder": "employee_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "supplementary_data", - "identifier": "employees", - "selectors": ["personal_details", "forename"] - }, - { - "source": "supplementary_data", - "identifier": "employees", - "selectors": ["personal_details", "surname"] - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - }, - "answers": [ - { - "id": "promoted-yes-no-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "enabled": { - "when": { - "and": [ - { - "==": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-2" - }, - "COMPLETED" - ] - }, - { - "==": [ - { - "source": "progress", - "selector": "section", - "identifier": "section-3" - }, - "COMPLETED" - ] - } - ] - } - }, - "id": "section-5", - "title": "Additional Employee Details", - "summary": { - "show_on_completion": true - }, - "repeat": { - "for_list": "additional-employees", - "title": { - "text": "{employee_name}", - "placeholders": [ - { - "placeholder": "employee_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "employee-first-name" - }, - { - "source": "answers", - "identifier": "employee-last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - }, - "groups": [ - { - "id": "additional-employee-detail-questions", - "blocks": [ - { - "type": "Question", - "id": "additional-length-of-employment", - "question": { - "id": "additional-length-employment-question", - "type": "General", - "title": { - "text": "When did {employee_name} start working for {company_name}?", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "supplementary_data", - "identifier": "company_name" - } - }, - { - "placeholder": "employee_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "employee-first-name" - }, - { - "source": "answers", - "identifier": "employee-last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - }, - "answers": [ - { - "id": "additional-employment-start", - "label": { - "text": "Start date at {company_name}", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "supplementary_data", - "identifier": "company_name" - } - } - ] - }, - "mandatory": true, - "type": "Date", - "maximum": { - "value": "now" - }, - "minimum": { - "value": { - "source": "supplementary_data", - "identifier": "incorporation_date" - } - } - } - ] - } - }, - { - "id": "conditional-additional-employee-block", - "type": "Question", - "skip_conditions": { - "when": { - "!=": [ - { - "count": [ - { - "source": "list", - "identifier": "additional-employees" - } - ] - }, - 3 - ] - } - }, - "question": { - "id": "conditional-additional-employee-question", - "guidance": { - "contents": [ - { - "description": "This block is enabled because there are 3 additional employees" - } - ] - }, - "type": "General", - "title": { - "text": "Has {employee_name} been promoted since starting at {company_name}?", - "placeholders": [ - { - "placeholder": "company_name", - "value": { - "source": "supplementary_data", - "identifier": "company_name" - } - }, - { - "placeholder": "employee_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "employee-first-name" - }, - { - "source": "answers", - "identifier": "employee-last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - }, - "answers": [ - { - "id": "additional-promoted-yes-no-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "section-6", - "title": "Product details", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "products", - "title": "Products", - "empty_list_text": "There are no products" - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "product-reporting", - "blocks": [ - { - "id": "list-collector-products", - "type": "ListCollectorContent", - "for_list": "products", - "page_title": "Products", - "content": { - "title": "Products", - "contents": [ - { - "description": "You have previously provided information for the above products. Please press continue to proceed to questions on value and volume of sales." - } - ] - }, - "repeating_blocks": [ - { - "id": "product-repeating-block-1", - "type": "ListRepeatingQuestion", - "question": { - "id": "product-repeating-block-1-question", - "type": "General", - "guidance": { - "contents": [ - { - "title": { - "text": "{guidance_include}", - "placeholders": [ - { - "placeholder": "guidance_include", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "supplementary_data", - "identifier": "products", - "selectors": ["guidance_include", "title"] - } - ] - } - } - ] - } - ] - }, - "description": { - "text": "{guidance_include_list}", - "placeholders": [ - { - "placeholder": "guidance_include_list", - "transforms": [ - { - "transform": "format_list", - "arguments": { - "list_to_format": { - "source": "supplementary_data", - "identifier": "products", - "selectors": ["guidance_include", "list"] - } - } - } - ] - } - ] - } - }, - { - "title": { - "text": "{guidance_exclude}", - "placeholders": [ - { - "placeholder": "guidance_exclude", - "transforms": [ - { - "transform": "first_non_empty_item", - "arguments": { - "items": [ - { - "source": "supplementary_data", - "identifier": "products", - "selectors": ["guidance_exclude", "title"] - } - ] - } - } - ] - } - ] - }, - "description": { - "text": "{guidance_exclude_list}", - "placeholders": [ - { - "placeholder": "guidance_exclude_list", - "transforms": [ - { - "transform": "format_list", - "arguments": { - "list_to_format": { - "source": "supplementary_data", - "identifier": "products", - "selectors": ["guidance_exclude", "list"] - } - } - } - ] - } - ] - } - } - ] - }, - "title": { - "text": "Volume of production and sales for {product_name}", - "placeholders": [ - { - "placeholder": "product_name", - "value": { - "source": "supplementary_data", - "identifier": "products", - "selectors": ["name"] - } - } - ] - }, - "answers": [ - { - "id": "product-volume-sales", - "label": { - "text": "{volume_sales} for {product_name}", - "placeholders": [ - { - "placeholder": "volume_sales", - "value": { - "source": "supplementary_data", - "identifier": "products", - "selectors": ["volume_sales", "label"] - } - }, - { - "placeholder": "product_name", - "value": { - "source": "supplementary_data", - "identifier": "products", - "selectors": ["name"] - } - } - ] - }, - "mandatory": false, - "type": "Unit", - "unit": "mass-kilogram", - "unit_length": "short" - }, - { - "id": "product-volume-total", - "label": { - "text": "{total_volume} for {product_name}", - "placeholders": [ - { - "placeholder": "total_volume", - "value": { - "source": "supplementary_data", - "identifier": "products", - "selectors": ["total_volume", "label"] - } - }, - { - "placeholder": "product_name", - "value": { - "source": "supplementary_data", - "identifier": "products", - "selectors": ["name"] - } - } - ] - }, - "mandatory": false, - "type": "Unit", - "unit": "mass-kilogram", - "unit_length": "short" - } - ] - } - } - ], - "summary": { - "title": "products", - "item_title": { - "text": "{product_name}", - "placeholders": [ - { - "placeholder": "product_name", - "value": { - "source": "supplementary_data", - "identifier": "products", - "selectors": ["name"] - } - } - ] - } - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-volume-sales", - "title": "We calculate the total volume of sales over the previous quarter to be %(total)s. Is this correct?", - "calculation": { - "title": "Total sales volume", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "product-volume-sales" - } - ] - } - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-volume-total", - "title": "We calculate the total volume produced over the previous quarter to be %(total)s. Is this correct?", - "calculation": { - "title": "Total volume produced", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "product-volume-total" - } - ] - } - } - }, - { - "type": "Question", - "id": "dynamic-products", - "skip_conditions": { - "when": { - "==": [ - { - "count": [ - { - "source": "list", - "identifier": "products" - } - ] - }, - 0 - ] - } - }, - "question": { - "dynamic_answers": { - "values": { - "source": "list", - "identifier": "products" - }, - "answers": [ - { - "label": { - "text": "{value_sales} for {product_name}", - "placeholders": [ - { - "placeholder": "value_sales", - "value": { - "source": "supplementary_data", - "identifier": "products", - "selectors": ["value_sales", "label"] - } - }, - { - "placeholder": "product_name", - "value": { - "source": "supplementary_data", - "identifier": "products", - "selectors": ["name"] - } - } - ] - }, - "id": "product-sales-answer", - "type": "Currency", - "mandatory": true, - "currency": "GBP", - "decimal_places": 2 - } - ] - }, - "answers": [ - { - "id": "extra-static-answer", - "label": "Value of sales from other categories", - "type": "Currency", - "mandatory": false, - "currency": "GBP", - "decimal_places": 2 - } - ], - "id": "dynamic-answer-question", - "title": "Sales during the previous quarter", - "type": "General" - } - }, - { - "type": "CalculatedSummary", - "id": "calculated-summary-value-sales", - "title": "We calculate the total value of sales over the previous quarter to be %(total)s. Is this correct?", - "calculation": { - "title": "Total sales value", - "operation": { - "+": [ - { - "source": "answers", - "identifier": "product-sales-answer" - }, - { - "source": "answers", - "identifier": "extra-static-answer" - } - ] - } - } - } - ] - } - ] - }, - { - "id": "section-7", - "title": "Sales targets", - "groups": [ - { - "id": "value-sales-group", - "blocks": [ - { - "id": "product-sales-interstitial", - "type": "Interstitial", - "content": { - "title": "Product value sales", - "contents": [ - { - "guidance": { - "contents": [ - { - "description": "The next block only shows when there are 2 products in the supplementary dataset." - }, - { - "description": "This is to test that section progress updates when swapping between supplementary datasets which remove or add list items" - } - ] - } - } - ] - } - }, - { - "id": "product-question-2-enabled", - "type": "Question", - "skip_conditions": { - "when": { - "!=": [ - { - "count": [ - { - "source": "list", - "identifier": "products" - } - ] - }, - 2 - ] - } - }, - "question": { - "id": "product-2-question", - "guidance": { - "contents": [ - { - "description": "This block is enabled because there are 2 products in the supplementary dataset" - } - ] - }, - "type": "General", - "title": { - "text": "Did the total value sales of {value_sales} over the last quarter meet the target?", - "placeholders": [ - { - "placeholder": "value_sales", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "source": "calculated_summary", - "identifier": "calculated-summary-value-sales" - } - } - } - ] - } - ] - }, - "answers": [ - { - "id": "value-yes-no-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - } - ] - } - ] - }, - { - "id": "section-8", - "title": "Production targets", - "groups": [ - { - "id": "volume-produced-group", - "blocks": [ - { - "id": "product-volume-interstitial", - "type": "Interstitial", - "content": { - "title": "Product volume produced", - "contents": [ - { - "guidance": { - "contents": [ - { - "description": "The next block only shows when there are 3 products in the supplementary dataset." - }, - { - "description": "This is to test that section progress updates when swapping between supplementary datasets which remove or add list items" - } - ] - } - } - ] - } - }, - { - "id": "product-question-3-enabled", - "type": "Question", - "skip_conditions": { - "when": { - "!=": [ - { - "count": [ - { - "source": "list", - "identifier": "products" - } - ] - }, - 3 - ] - } - }, - "question": { - "id": "product-3-question", - "guidance": { - "contents": [ - { - "description": "This block is enabled because there are 3 products in the supplementary dataset" - } - ] - }, - "type": "General", - "title": { - "text": "Did the total volume produced of {volume_produced} over the last quarter meet the target?", - "placeholders": [ - { - "placeholder": "volume_produced", - "transforms": [ - { - "transform": "format_unit", - "arguments": { - "value": { - "source": "calculated_summary", - "identifier": "calculated-summary-volume-total" - }, - "unit": "mass-kilogram", - "unit_length": "short" - } - } - ] - } - ] - }, - "answers": [ - { - "id": "volume-yes-no-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_textarea.json b/schemas/test/en/test_textarea.json deleted file mode 100644 index 5029fbace6..0000000000 --- a/schemas/test/en/test_textarea.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Other input fields", - "theme": "default", - "description": "A questionnaire to test textareas.", - "messages": { - "NUMBER_TOO_LARGE": "Number is too large", - "NUMBER_TOO_SMALL": "Number cannot be less than zero", - "INVALID_NUMBER": "Please enter an integer" - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "textarea-block", - "question": { - "answers": [ - { - "id": "answer", - "label": "Enter your comments", - "rows": 3, - "mandatory": false, - "type": "TextArea", - "max_length": 20, - "validation": { - "messages": { - "MAX_LENGTH_EXCEEDED": "You have entered too many characters. Enter up to %(max)d characters" - } - } - } - ], - "id": "question", - "title": "Title", - "type": "General" - } - } - ], - "id": "textarea-group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_textfield.json b/schemas/test/en/test_textfield.json deleted file mode 100644 index 8ca7bbc3e1..0000000000 --- a/schemas/test/en/test_textfield.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Other input fields", - "theme": "default", - "description": "A questionnaire to test textfields", - "messages": { - "NUMBER_TOO_LARGE": "Number is too large", - "NUMBER_TOO_SMALL": "Number cannot be less than zero", - "INVALID_NUMBER": "Please enter an integer" - }, - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "name-block", - "question": { - "answers": [ - { - "id": "name-answer", - "label": "What is your name?", - "max_length": 20, - "mandatory": false, - "type": "TextField" - } - ], - "id": "name-question", - "title": "Title", - "type": "General" - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_textfield_suggestions.json b/schemas/test/en/test_textfield_suggestions.json deleted file mode 100644 index b282c33440..0000000000 --- a/schemas/test/en/test_textfield_suggestions.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Textfield Suggestions", - "theme": "default", - "description": "A questionnaire to test textfield suggestions", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "country-block", - "question": { - "answers": [ - { - "id": "country-answer", - "label": "Country", - "mandatory": false, - "suggestions": { - "url": "https://cdn.eq.gcp.onsdigital.uk/eq-lookup-suggestions-data/v5.5.0/gb/en/countries-of-birth.json", - "allow_multiple": false - }, - "type": "TextField" - } - ], - "id": "country-of-birth-question", - "title": "What is your country of birth?", - "type": "General" - } - }, - { - "type": "Question", - "id": "multiple-country-block", - "question": { - "answers": [ - { - "id": "multiple-country-answer", - "label": "Passports", - "mandatory": false, - "suggestions": { - "url": "https://cdn.eq.gcp.onsdigital.uk/eq-lookup-suggestions-data/v5.5.0/gb/en/passport-countries.json", - "allow_multiple": true - }, - "type": "TextField" - } - ], - "id": "multiple-country-question", - "title": "What passports do you hold?", - "type": "General" - } - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_thank_you.json b/schemas/test/en/test_thank_you.json deleted file mode 100644 index 57d01e1e1e..0000000000 --- a/schemas/test/en/test_thank_you.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "001", - "title": "Test Thank You", - "theme": "default", - "description": "A questionnaire to test post submission params", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "post_submission": { - "guidance": { - "contents": [ - { - "description": "This survey was important." - }, - { - "description": "Important link" - } - ] - }, - "view_response": true - }, - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "blocks": [ - { - "id": "did-you-know", - "question": { - "answers": [ - { - "id": "answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "question", - "title": "Did you know this schema is testing post submission params?", - "type": "General" - }, - "type": "Question" - } - ], - "id": "group" - } - ] - } - ] -} diff --git a/schemas/test/en/test_theme_dbt.json b/schemas/test/en/test_theme_dbt.json deleted file mode 100644 index be7981734c..0000000000 --- a/schemas/test/en/test_theme_dbt.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Department for Business and Trade", - "theme": "dbt", - "description": "A questionnaire to demo the DBT survey theme", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "radio", - "question": { - "answers": [ - { - "id": "radio-answer", - "mandatory": false, - "options": [ - { - "label": "Bacon", - "value": "Bacon" - }, - { - "label": "Eggs", - "value": "Eggs" - }, - { - "label": "Sausage", - "value": "Sausage" - } - ], - "type": "Radio" - } - ], - "id": "radio-question", - "title": "What is your favourite breakfast food?", - "type": "General" - } - } - ], - "id": "group", - "title": "DBT Theme Test" - } - ] - } - ] -} diff --git a/schemas/test/en/test_theme_dbt_dsit.json b/schemas/test/en/test_theme_dbt_dsit.json deleted file mode 100644 index 0395f918d4..0000000000 --- a/schemas/test/en/test_theme_dbt_dsit.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Department for Business and Trade and Department for Science, Innovation and Technology", - "theme": "dbt-dsit", - "description": "A questionnaire to demo the DBT-DSIT survey theme", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "radio", - "question": { - "answers": [ - { - "id": "radio-answer", - "mandatory": false, - "options": [ - { - "label": "Bacon", - "value": "Bacon" - }, - { - "label": "Eggs", - "value": "Eggs" - }, - { - "label": "Sausage", - "value": "Sausage" - } - ], - "type": "Radio" - } - ], - "id": "radio-question", - "title": "What is your favourite breakfast food?", - "type": "General" - } - } - ], - "id": "group", - "title": "DBT-DSIT Theme Test" - } - ] - } - ] -} diff --git a/schemas/test/en/test_theme_dbt_dsit_ni.json b/schemas/test/en/test_theme_dbt_dsit_ni.json deleted file mode 100644 index 8a5cf9c642..0000000000 --- a/schemas/test/en/test_theme_dbt_dsit_ni.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test NI Department for Business and Trade and Department for Science, Innovation and Technology", - "theme": "dbt-dsit-ni", - "description": "A questionnaire to demo the DBT-DSIT-NI survey theme", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "radio", - "question": { - "answers": [ - { - "id": "radio-answer", - "mandatory": false, - "options": [ - { - "label": "Bacon", - "value": "Bacon" - }, - { - "label": "Eggs", - "value": "Eggs" - }, - { - "label": "Sausage", - "value": "Sausage" - } - ], - "type": "Radio" - } - ], - "id": "radio-question", - "title": "What is your favourite breakfast food?", - "type": "General" - } - } - ], - "id": "group", - "title": "DBT-DSIT-NI Theme Test" - } - ] - } - ] -} diff --git a/schemas/test/en/test_theme_dbt_ni.json b/schemas/test/en/test_theme_dbt_ni.json deleted file mode 100644 index b8cf5716d0..0000000000 --- a/schemas/test/en/test_theme_dbt_ni.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test NI Department for Business and Trade", - "theme": "dbt-ni", - "description": "A questionnaire to demo the DBT-NI survey theme", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "radio", - "question": { - "answers": [ - { - "id": "radio-answer", - "mandatory": false, - "options": [ - { - "label": "Bacon", - "value": "Bacon" - }, - { - "label": "Eggs", - "value": "Eggs" - }, - { - "label": "Sausage", - "value": "Sausage" - } - ], - "type": "Radio" - } - ], - "id": "radio-question", - "title": "What is your favourite breakfast food?", - "type": "General" - } - } - ], - "id": "group", - "title": "DBT-NI Theme Test" - } - ] - } - ] -} diff --git a/schemas/test/en/test_theme_desnz.json b/schemas/test/en/test_theme_desnz.json deleted file mode 100644 index c1aa83755f..0000000000 --- a/schemas/test/en/test_theme_desnz.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Department for Energy Security and Net Zero", - "theme": "desnz", - "description": "A questionnaire to demo the DESNZ survey theme", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "radio", - "question": { - "answers": [ - { - "id": "radio-answer", - "mandatory": false, - "options": [ - { - "label": "Bacon", - "value": "Bacon" - }, - { - "label": "Eggs", - "value": "Eggs" - }, - { - "label": "Sausage", - "value": "Sausage" - } - ], - "type": "Radio" - } - ], - "id": "radio-question", - "title": "What is your favourite breakfast food?", - "type": "General" - } - } - ], - "id": "group", - "title": "DESNZ Theme Test" - } - ] - } - ] -} diff --git a/schemas/test/en/test_theme_desnz_ni.json b/schemas/test/en/test_theme_desnz_ni.json deleted file mode 100644 index 06751903f5..0000000000 --- a/schemas/test/en/test_theme_desnz_ni.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test NI Department for Energy Security and Net Zero", - "theme": "desnz-ni", - "description": "A questionnaire to demo the DESNZ-NI survey theme", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "radio", - "question": { - "answers": [ - { - "id": "radio-answer", - "mandatory": false, - "options": [ - { - "label": "Bacon", - "value": "Bacon" - }, - { - "label": "Eggs", - "value": "Eggs" - }, - { - "label": "Sausage", - "value": "Sausage" - } - ], - "type": "Radio" - } - ], - "id": "radio-question", - "title": "What is your favourite breakfast food?", - "type": "General" - } - } - ], - "id": "group", - "title": "DESNZ-NI Theme Test" - } - ] - } - ] -} diff --git a/schemas/test/en/test_theme_health.json b/schemas/test/en/test_theme_health.json deleted file mode 100644 index e88814e7c6..0000000000 --- a/schemas/test/en/test_theme_health.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Health Survey", - "theme": "health", - "description": "A questionnaire to demo the health survey theme", - "metadata": [ - { - "name": "qid", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "post_submission": { - "view_response": true - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "radio", - "question": { - "answers": [ - { - "id": "radio-answer", - "mandatory": false, - "options": [ - { - "label": "Bacon", - "value": "Bacon" - }, - { - "label": "Eggs", - "value": "Eggs" - }, - { - "label": "Sausage", - "value": "Sausage" - } - ], - "type": "Radio" - } - ], - "id": "radio-question", - "title": "What is your favourite breakfast food?", - "type": "General" - } - } - ], - "id": "group", - "title": "Health Theme Test" - } - ] - } - ] -} diff --git a/schemas/test/en/test_theme_northernireland.json b/schemas/test/en/test_theme_northernireland.json deleted file mode 100644 index 569698acb7..0000000000 --- a/schemas/test/en/test_theme_northernireland.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Northern Ireland Survey", - "theme": "northernireland", - "description": "A questionnaire to demo the northernireland survey theme", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "radio", - "question": { - "answers": [ - { - "id": "radio-answer", - "mandatory": false, - "options": [ - { - "label": "Bacon", - "value": "Bacon" - }, - { - "label": "Eggs", - "value": "Eggs" - }, - { - "label": "Sausage", - "value": "Sausage" - } - ], - "type": "Radio" - } - ], - "id": "radio-question", - "title": "What is your favourite breakfast food?", - "type": "General" - } - } - ], - "id": "group", - "title": "Northern Ireland Theme Test" - } - ] - } - ] -} diff --git a/schemas/test/en/test_theme_ons_nhs.json b/schemas/test/en/test_theme_ons_nhs.json deleted file mode 100644 index e733508d94..0000000000 --- a/schemas/test/en/test_theme_ons_nhs.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test ONS NHS Survey", - "theme": "ons-nhs", - "description": "A questionnaire to demo the ons-nhs survey theme", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "radio", - "question": { - "answers": [ - { - "id": "radio-answer", - "mandatory": false, - "options": [ - { - "label": "Bacon", - "value": "Bacon" - }, - { - "label": "Eggs", - "value": "Eggs" - }, - { - "label": "Sausage", - "value": "Sausage" - } - ], - "type": "Radio" - } - ], - "id": "radio-question", - "title": "What is your favourite breakfast food?", - "type": "General" - } - } - ], - "id": "group", - "title": "ONS NHS Theme Test" - } - ] - } - ] -} diff --git a/schemas/test/en/test_theme_orr.json b/schemas/test/en/test_theme_orr.json deleted file mode 100644 index 15aad627c3..0000000000 --- a/schemas/test/en/test_theme_orr.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Rail and Road Survey", - "theme": "orr", - "description": "A questionnaire to demo the ORR survey theme", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "radio", - "question": { - "answers": [ - { - "id": "radio-answer", - "mandatory": false, - "options": [ - { - "label": "Bacon", - "value": "Bacon" - }, - { - "label": "Eggs", - "value": "Eggs" - }, - { - "label": "Sausage", - "value": "Sausage" - } - ], - "type": "Radio" - } - ], - "id": "radio-question", - "title": "What is your favourite breakfast food?", - "type": "General" - } - } - ], - "id": "group", - "title": "ORR Theme Test" - } - ] - } - ] -} diff --git a/schemas/test/en/test_theme_social.json b/schemas/test/en/test_theme_social.json deleted file mode 100644 index 689a74f0b9..0000000000 --- a/schemas/test/en/test_theme_social.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Social Survey", - "theme": "social", - "description": "A questionnaire to demo the social survey theme", - "metadata": [ - { - "name": "qid", - "type": "string" - } - ], - "post_submission": { - "view_response": true, - "feedback": true - }, - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "radio", - "question": { - "answers": [ - { - "id": "radio-answer", - "mandatory": false, - "options": [ - { - "label": "Bacon", - "value": "Bacon" - }, - { - "label": "Eggs", - "value": "Eggs" - }, - { - "label": "Sausage", - "value": "Sausage" - } - ], - "type": "Radio" - } - ], - "id": "radio-question", - "title": "What is your favourite breakfast food?", - "type": "General" - } - } - ], - "id": "group", - "title": "Social Theme Test" - } - ] - } - ] -} diff --git a/schemas/test/en/test_theme_ukhsa_ons.json b/schemas/test/en/test_theme_ukhsa_ons.json deleted file mode 100644 index 9c72466d79..0000000000 --- a/schemas/test/en/test_theme_ukhsa_ons.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test UKHSA ONS Survey", - "theme": "ukhsa-ons", - "description": "A questionnaire to demo the UKHSA ONS survey theme", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "radio", - "question": { - "answers": [ - { - "id": "radio-answer", - "mandatory": false, - "options": [ - { - "label": "Bacon", - "value": "Bacon" - }, - { - "label": "Eggs", - "value": "Eggs" - }, - { - "label": "Sausage", - "value": "Sausage" - } - ], - "type": "Radio" - } - ], - "id": "radio-question", - "title": "What is your favourite breakfast food?", - "type": "General" - } - } - ], - "id": "group", - "title": "UKHSA ONS Theme Test" - } - ] - } - ] -} diff --git a/schemas/test/en/test_timeout.json b/schemas/test/en/test_timeout.json deleted file mode 100644 index 85e23ee42c..0000000000 --- a/schemas/test/en/test_timeout.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "session_timeout_in_seconds": 5, - "title": "Timeout test", - "theme": "default", - "description": "A questionnaire to test the timeout functionality in non JS integration test", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "timeout-group", - "title": "Timeout", - "blocks": [ - { - "type": "Question", - "id": "timeout-block", - "question": { - "answers": [ - { - "id": "timeout-answer", - "label": "Does the timeout appear?", - "mandatory": false, - "type": "TextField" - } - ], - "id": "timeout-question", - "title": "Timeout title", - "type": "General" - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_timeout_modal.json b/schemas/test/en/test_timeout_modal.json deleted file mode 100644 index 8386c21947..0000000000 --- a/schemas/test/en/test_timeout_modal.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "session_timeout_in_seconds": 125, - "title": "Timeout modal test", - "theme": "default", - "description": "A questionnaire to test the timeout modal functionality", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "timeout-group", - "title": "Timeout modal", - "blocks": [ - { - "id": "timeout-modal-interstitial", - "content": { - "title": "Timeout modal interstitial", - "contents": [ - { - "description": "Timeout modal will appear on this page after 65 seconds as the session timeout is set to 125 seconds, pressing “Continue survey” button on the modal will extend the session by that amount, “showModalTimeInSeconds” field is set to 60" - } - ] - }, - "type": "Interstitial" - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_title.json b/schemas/test/en/test_title.json deleted file mode 100644 index cb9c593307..0000000000 --- a/schemas/test/en/test_title.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Question Title Test", - "theme": "default", - "description": "A questionnaire to test question titles", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "group", - "blocks": [ - { - "type": "Question", - "id": "single-title-block", - "question": { - "id": "single-title-question", - "title": "How are you feeling??", - "type": "General", - "answers": [ - { - "type": "Radio", - "id": "feeling-answer", - "mandatory": true, - "options": [ - { - "label": "Good", - "value": "Good" - }, - { - "label": "Bad", - "value": "Bad" - } - ] - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_titles_radio_and_checkbox.json b/schemas/test/en/test_titles_radio_and_checkbox.json deleted file mode 100644 index e40074c8db..0000000000 --- a/schemas/test/en/test_titles_radio_and_checkbox.json +++ /dev/null @@ -1,353 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Survey - Checkbox and Radio titles", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "radio-checkbox-group", - "blocks": [ - { - "id": "preamble-block", - "type": "Question", - "question": { - "id": "name-question", - "title": "What is your name?", - "type": "General", - "guidance": { - "contents": [ - { - "description": "The answer you write will have an effect on question titles in next question", - "list": [ - "If you type ‘Peter’, the question will be aimed for Peter", - "If you type ‘Mary’, the question will be aimed for Mary", - "If you type anything else the question will be the default question" - ] - } - ] - }, - "answers": [ - { - "id": "name-answer", - "label": "Your name", - "type": "TextField", - "mandatory": true - } - ] - } - }, - { - "type": "Question", - "id": "checkbox-block", - "question_variants": [ - { - "when": { - "==": [ - { - "source": "answers", - "identifier": "name-answer" - }, - "Peter" - ] - }, - "question": { - "id": "checkbox-question", - "type": "General", - "title": "Did Peter make changes to this business?", - "answers": [ - { - "id": "checkbox-answer", - "type": "Checkbox", - "mandatory": true, - "options": [ - { - "label": "New business practices for organising procedures", - "value": "New business practices for organising procedures" - }, - { - "label": "New methods of organising work responsibilities and decision making", - "value": "New methods of organising work responsibilities and decision making" - }, - { - "label": "New methods of organising external relationships with other firms or public institutions", - "value": "New methods of organising external relationships with other firms or public institutions" - }, - { - "label": "Implementation of changes to marketing concepts or strategies", - "value": "Implementation of changes to marketing concepts or strategies" - } - ] - } - ] - } - }, - { - "when": { - "==": [ - { - "source": "answers", - "identifier": "name-answer" - }, - "Mary" - ] - }, - "question": { - "id": "checkbox-question", - "type": "General", - "title": "Did Mary make changes to this business?", - "answers": [ - { - "id": "checkbox-answer", - "type": "Checkbox", - "mandatory": true, - "options": [ - { - "label": "New business practices for organising procedures", - "value": "New business practices for organising procedures" - }, - { - "label": "New methods of organising work responsibilities and decision making", - "value": "New methods of organising work responsibilities and decision making" - }, - { - "label": "New methods of organising external relationships with other firms or public institutions", - "value": "New methods of organising external relationships with other firms or public institutions" - }, - { - "label": "Implementation of changes to marketing concepts or strategies", - "value": "Implementation of changes to marketing concepts or strategies" - } - ] - } - ] - } - }, - { - "when": { - "!=": [ - { - "source": "answers", - "identifier": "name-answer" - }, - "Mary" - ] - }, - "question": { - "id": "checkbox-question", - "type": "General", - "title": "Did this business make major changes in the following areas?", - "answers": [ - { - "id": "checkbox-answer", - "type": "Checkbox", - "mandatory": true, - "options": [ - { - "label": "New business practices for organising procedures", - "value": "New business practices for organising procedures" - }, - { - "label": "New methods of organising work responsibilities and decision making", - "value": "New methods of organising work responsibilities and decision making" - }, - { - "label": "New methods of organising external relationships with other firms or public institutions", - "value": "New methods of organising external relationships with other firms or public institutions" - }, - { - "label": "Implementation of changes to marketing concepts or strategies", - "value": "Implementation of changes to marketing concepts or strategies" - } - ] - } - ] - } - } - ] - }, - { - "type": "Question", - "id": "radio-block", - "question_variants": [ - { - "when": { - "==": [ - { - "source": "answers", - "identifier": "name-answer" - }, - "Peter" - ] - }, - "question": { - "id": "radio-question", - "type": "General", - "title": "Is Peter the boss?", - "answers": [ - { - "id": "radio-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - }, - { - "label": "Maybe", - "value": "Maybe" - }, - { - "label": "I don’t know", - "value": "I don’t know" - }, - { - "label": "Can you repeat the question", - "value": "Can you repeat the question" - } - ] - } - ] - } - }, - { - "when": { - "==": [ - { - "source": "answers", - "identifier": "name-answer" - }, - "Mary" - ] - }, - "question": { - "id": "radio-question", - "type": "General", - "title": "Is Mary the boss?", - "answers": [ - { - "id": "radio-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - }, - { - "label": "Maybe", - "value": "Maybe" - }, - { - "label": "I don’t know", - "value": "I don’t know" - }, - { - "label": "Can you repeat the question", - "value": "Can you repeat the question" - } - ] - } - ] - } - }, - { - "when": { - "!=": [ - { - "source": "answers", - "identifier": "name-answer" - }, - "Mary" - ] - }, - "question": { - "id": "radio-question", - "type": "General", - "title": { - "text": "Is {name} the boss?", - "placeholders": [ - { - "placeholder": "name", - "value": { - "source": "answers", - "identifier": "name-answer" - } - } - ] - }, - "answers": [ - { - "id": "radio-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - }, - { - "label": "Maybe", - "value": "Maybe" - }, - { - "label": "I don’t know", - "value": "I don’t know" - }, - { - "label": "Can you repeat the question", - "value": "Can you repeat the question" - } - ] - } - ] - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_unit_patterns.json b/schemas/test/en/test_unit_patterns.json deleted file mode 100644 index d795d95653..0000000000 --- a/schemas/test/en/test_unit_patterns.json +++ /dev/null @@ -1,277 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "999", - "title": "Test Unit Patterns", - "description": "Tests for localised (UK rendering) measurements.", - "theme": "default", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "set-length-units-block", - "question": { - "answers": [ - { - "id": "centimetres", - "label": "Length in Centimetres", - "mandatory": false, - "type": "Unit", - "unit": "length-centimeter", - "unit_length": "short", - "maximum": { - "value": 1000 - } - }, - { - "id": "metres", - "label": "Length in Metres", - "mandatory": false, - "type": "Unit", - "unit": "length-meter", - "unit_length": "short", - "maximum": { - "value": 1000 - } - }, - { - "id": "kilometres", - "label": "Length in Kilometres", - "mandatory": false, - "type": "Unit", - "unit": "length-kilometer", - "unit_length": "short", - "maximum": { - "value": 1000 - } - }, - { - "id": "miles", - "label": "Length in Miles", - "mandatory": false, - "type": "Unit", - "unit": "length-mile", - "unit_length": "short", - "maximum": { - "value": 1000 - } - }, - { - "id": "min-max-miles", - "label": "Length in Miles - Min Max Range", - "mandatory": false, - "type": "Unit", - "unit": "length-mile", - "unit_length": "short", - "minimum": { - "value": -99999999999999 - } - } - ], - "id": "set-length-units-question", - "title": "Length Units", - "type": "General" - } - }, - { - "type": "Question", - "id": "set-duration-units-block", - "question": { - "answers": [ - { - "id": "duration-hour", - "label": "Hour", - "mandatory": false, - "type": "Unit", - "unit": "duration-hour", - "unit_length": "long", - "maximum": { - "value": 99 - } - }, - { - "id": "duration-year", - "label": "Years", - "mandatory": false, - "type": "Unit", - "unit": "duration-year", - "unit_length": "long", - "maximum": { - "value": 99 - } - } - ], - "id": "set-duration-units-question", - "title": "Duration Units", - "type": "General" - } - }, - { - "type": "Question", - "id": "set-area-units-block", - "question": { - "answers": [ - { - "id": "square-centimetres", - "label": "Centimetres Square", - "mandatory": false, - "type": "Unit", - "unit": "area-square-centimeter", - "unit_length": "short" - }, - { - "id": "square-metres", - "label": "Metres Square", - "mandatory": false, - "type": "Unit", - "unit": "area-square-meter", - "unit_length": "short" - }, - { - "id": "square-kilometres", - "label": "Kilometres Square", - "mandatory": false, - "type": "Unit", - "unit": "area-square-kilometer", - "unit_length": "short" - }, - { - "id": "square-miles", - "label": "Miles Square", - "mandatory": false, - "type": "Unit", - "unit": "area-square-mile", - "unit_length": "short" - }, - { - "id": "acres", - "label": "Acres", - "mandatory": false, - "type": "Unit", - "unit": "area-acre", - "unit_length": "short" - }, - { - "id": "hectares", - "label": "Hectares", - "mandatory": false, - "type": "Unit", - "unit": "area-hectare", - "unit_length": "short" - } - ], - "id": "set-area-unit-questions", - "title": "Area Units", - "type": "General" - } - }, - { - "type": "Question", - "id": "set-volume-units-block", - "question": { - "answers": [ - { - "id": "cubic-centimetres", - "label": "Cubic Centimetres", - "mandatory": false, - "type": "Unit", - "unit": "volume-cubic-centimeter", - "unit_length": "short", - "decimal_places": 6 - }, - { - "id": "cubic-metres", - "label": "Cubic Metres", - "mandatory": false, - "type": "Unit", - "unit": "volume-cubic-meter", - "unit_length": "short", - "decimal_places": 6 - }, - { - "id": "litres", - "label": "Litres", - "mandatory": false, - "type": "Unit", - "unit": "volume-liter", - "unit_length": "short", - "decimal_places": 6 - }, - { - "id": "hectolitres", - "label": "Hectolitres", - "mandatory": false, - "type": "Unit", - "unit": "volume-hectoliter", - "unit_length": "short", - "decimal_places": 6 - }, - { - "id": "megalitres", - "label": "Megalitres", - "mandatory": false, - "type": "Unit", - "unit": "volume-megaliter", - "unit_length": "short", - "decimal_places": 6 - } - ], - "id": "set-volume-unit-questions", - "title": "Volume Units", - "type": "General" - } - }, - { - "type": "Question", - "id": "set-weight-units-block", - "question": { - "answers": [ - { - "id": "mass-tonne", - "label": "Mass tonnes", - "mandatory": false, - "type": "Unit", - "unit": "mass-tonne", - "unit_length": "short" - } - ], - "id": "set-weight-unit-questions", - "title": "Weight Units", - "type": "General" - } - } - ], - "id": "test" - } - ] - } - ] -} diff --git a/schemas/test/en/test_validation_sum_against_total_dynamic_answers.json b/schemas/test/en/test_validation_sum_against_total_dynamic_answers.json deleted file mode 100644 index b2ec85409f..0000000000 --- a/schemas/test/en/test_validation_sum_against_total_dynamic_answers.json +++ /dev/null @@ -1,470 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "A test schema to validate a sum of dynamic answers are equal to a given total", - "theme": "default", - "description": "A survey that tests calculated answers against a total", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - - "questionnaire_flow": { - "type": "Hub", - "options": { - "required_completed_sections": ["total-section"] - } - }, - "sections": [ - { - "id": "total-section", - "title": "Total", - "groups": [ - { - "blocks": [ - { - "type": "Question", - "id": "total-block", - "question": { - "guidance": { - "contents": [ - { - "description": "Answer will be used for validation in the next section." - } - ] - }, - "id": "total-question", - "title": "What percentage of your shopping do you do at supermarkets?", - "type": "General", - "answers": [ - { - "id": "total-answer", - "label": "Total", - "mandatory": true, - "type": "Percentage", - "maximum": { - "value": 100 - }, - "decimal_places": 0 - } - ] - } - } - ], - "id": "total-group" - } - ] - }, - { - "id": "dynamic-answers-section", - "title": "Supermarkets", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "supermarkets", - "title": "Household members", - "add_link_text": "Add another supermarket", - "empty_list_text": "There are no supermarkets" - } - ], - "show_non_item_answers": true - }, - "groups": [ - { - "id": "group", - "blocks": [ - { - "type": "ListCollectorDrivingQuestion", - "id": "any-supermarket", - "for_list": "supermarkets", - "question": { - "type": "General", - "id": "any-supermarket-question", - "title": "Do you need to add any supermarkets?", - "answers": [ - { - "type": "Radio", - "id": "any-supermarket-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock", - "params": { - "block_id": "add-supermarket", - "list_name": "supermarkets" - } - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "routing_rules": [ - { - "section": "End", - "when": { - "==": [ - { - "source": "answers", - "identifier": "any-supermarket-answer" - }, - "No" - ] - } - }, - { - "block": "list-collector" - } - ] - }, - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "supermarkets", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Do you need to add any more supermarkets?", - "answers": [ - { - "id": "list-collector-answer", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-supermarket", - "type": "ListAddQuestion", - "cancel_text": "Don’t need to add any other supermarkets?", - "question": { - "guidance": { - "contents": [ - { - "description": "Maximum spending value will be used for each supermarket’s max spending validation and placeholders." - } - ] - }, - "id": "add-question", - "type": "General", - "title": "Which supermarkets do you use for your weekly shopping?", - "answers": [ - { - "id": "supermarket-name", - "label": "Supermarket", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-supermarket", - "type": "ListEditQuestion", - "cancel_text": "Don’t need to change anything?", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the supermarket?", - "answers": [ - { - "id": "supermarket-name", - "label": "Supermarket", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-supermarket", - "type": "ListRemoveQuestion", - "cancel_text": "Don’t need to remove this supermarket?", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this supermarket?", - "warning": "All of the information about this supermarket will be deleted", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Supermarkets", - "item_title": { - "text": "{supermarket_name}", - "placeholders": [ - { - "placeholder": "supermarket_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "supermarket-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - }, - { - "type": "Question", - "id": "dynamic-answer", - "skip_conditions": { - "when": { - "==": [ - { - "count": [ - { - "source": "list", - "identifier": "supermarkets" - } - ] - }, - 0 - ] - } - }, - "question": { - "guidance": { - "contents": [ - { - "description": "Answers are validated against total percentage from previous section." - } - ] - }, - "dynamic_answers": { - "values": { - "source": "list", - "identifier": "supermarkets" - }, - "answers": [ - { - "label": { - "text": "Percentage of shopping at {transformed_value}", - "placeholders": [ - { - "placeholder": "transformed_value", - "value": { - "source": "answers", - "identifier": "supermarket-name" - } - } - ] - }, - "id": "percentage-of-shopping", - "mandatory": false, - "type": "Percentage", - "maximum": { - "value": 100 - }, - "decimal_places": 0 - } - ] - }, - "answers": [ - { - "label": { - "text": "Percentage of shopping elsewhere", - "placeholders": [ - { - "placeholder": "transformed_value", - "value": { - "source": "answers", - "identifier": "supermarket-name" - } - } - ] - }, - "id": "percentage-of-shopping-elsewhere", - "mandatory": false, - "type": "Percentage", - "maximum": { - "value": 100 - }, - "decimal_places": 0 - } - ], - "warning": "These answers must add up to the total provided in the previous section", - "calculations": [ - { - "calculation_type": "sum", - "answer_id": "total-answer", - "answers_to_calculate": ["percentage-of-shopping-elsewhere", "percentage-of-shopping"], - "conditions": ["equals"] - } - ], - "id": "dynamic-answer-question", - "title": "What percent of your shopping do you do at each of the following supermarket?", - "type": "Calculated" - } - }, - { - "type": "Question", - "id": "total-block-other", - "question": { - "guidance": { - "contents": [ - { - "description": "Answer will be used for validation in the next question." - } - ] - }, - "id": "total-question-other", - "title": "Total amount you spend", - "type": "General", - "answers": [ - { - "id": "total-answer-other", - "label": "Total", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "dynamic-answer-only", - "skip_conditions": { - "when": { - "==": [ - { - "count": [ - { - "source": "list", - "identifier": "supermarkets" - } - ] - }, - 0 - ] - } - }, - "question": { - "guidance": { - "contents": [ - { - "description": "Answers are validated against total amount from previous question." - } - ] - }, - "dynamic_answers": { - "values": { - "source": "list", - "identifier": "supermarkets" - }, - "answers": [ - { - "label": { - "text": "How much do you spend at {transformed_value}", - "placeholders": [ - { - "placeholder": "transformed_value", - "value": { - "source": "answers", - "identifier": "supermarket-name" - } - } - ] - }, - "id": "spending-amount", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "maximum": { - "value": { - "source": "answers", - "identifier": "total-answer-other" - } - }, - "minimum": { - "value": 0 - } - } - ] - }, - "warning": "These answers must add up to the total provided in the previous question", - "calculations": [ - { - "calculation_type": "sum", - "answer_id": "total-answer-other", - "answers_to_calculate": ["spending-amount"], - "conditions": ["equals"] - } - ], - "id": "dynamic-answer-only-question", - "title": "How much do you spend at each of the following supermarket?", - "type": "Calculated" - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_validation_sum_against_total_equal.json b/schemas/test/en/test_validation_sum_against_total_equal.json deleted file mode 100644 index 5ec8e0e3fa..0000000000 --- a/schemas/test/en/test_validation_sum_against_total_equal.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "A test schema to validate a sum of answers are Equal to a given total", - "theme": "default", - "description": "A survey that tests grouped and calculated answers against a total", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "group", - "title": "Validate sum against total", - "blocks": [ - { - "type": "Question", - "id": "total-block", - "question": { - "id": "total-question", - "title": "Total", - "type": "General", - "answers": [ - { - "id": "total-answer", - "label": "Total", - "mandatory": true, - "type": "Number", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "breakdown-block", - "question": { - "id": "breakdown-question", - "title": "Breakdown", - "type": "Calculated", - "warning": "These answers must add up to the total provided in the previous question", - "calculations": [ - { - "calculation_type": "sum", - "answer_id": "total-answer", - "answers_to_calculate": ["breakdown-1", "breakdown-2", "breakdown-3", "breakdown-4"], - "conditions": ["equals"] - } - ], - "answers": [ - { - "id": "breakdown-1", - "label": "Breakdown 1", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - }, - { - "id": "breakdown-2", - "label": "Breakdown 2", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - }, - { - "id": "breakdown-3", - "label": "Breakdown 3", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - }, - { - "id": "breakdown-4", - "label": "Breakdown 4", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_validation_sum_against_total_equal_or_less_than.json b/schemas/test/en/test_validation_sum_against_total_equal_or_less_than.json deleted file mode 100644 index 2e33832bdd..0000000000 --- a/schemas/test/en/test_validation_sum_against_total_equal_or_less_than.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "A test schema to validate a sum of answers are Less Than or Equal to a given total", - "theme": "default", - "description": "A survey that tests grouped and calculated answers against a total", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "group", - "title": "Validate sum against total", - "blocks": [ - { - "type": "Question", - "id": "total-block", - "question": { - "id": "total-question", - "title": "Total", - "type": "General", - "answers": [ - { - "id": "total-answer", - "label": "Total", - "mandatory": true, - "type": "Number", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "breakdown-block", - "question": { - "id": "breakdown-question", - "title": "Breakdown", - "type": "Calculated", - "calculations": [ - { - "calculation_type": "sum", - "answer_id": "total-answer", - "answers_to_calculate": ["breakdown-1", "breakdown-2", "breakdown-3", "breakdown-4"], - "conditions": ["less than", "equals"] - } - ], - "answers": [ - { - "id": "breakdown-1", - "label": "Breakdown 1", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - }, - { - "id": "breakdown-2", - "label": "Breakdown 2", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - }, - { - "id": "breakdown-3", - "label": "Breakdown 3", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - }, - { - "id": "breakdown-4", - "label": "Breakdown 4", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_validation_sum_against_total_hub_with_dependent_section.json b/schemas/test/en/test_validation_sum_against_total_hub_with_dependent_section.json deleted file mode 100644 index 7001c9d763..0000000000 --- a/schemas/test/en/test_validation_sum_against_total_hub_with_dependent_section.json +++ /dev/null @@ -1,252 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Calculated Question - Total In Separate Section (Hub)", - "theme": "default", - "description": "A questionnaire to test calculated question with total in a separate section using the Hub", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { "required_completed_sections": ["company-overview-section"] } - }, - "sections": [ - { - "id": "company-overview-section", - "title": "Overview", - "summary": { - "show_on_completion": true - }, - "groups": [ - { - "id": "company-overview-group", - "title": "Turnover & Employees", - "blocks": [ - { - "type": "Question", - "id": "total-turnover-block", - "question": { - "id": "total-turnover-question", - "title": "What was your total turnover for 2021?", - "type": "General", - "answers": [ - { - "id": "total-turnover-answer", - "label": "Total turnover", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "minimum": { - "value": 0, - "exclusive": true - } - } - ] - } - }, - { - "type": "Question", - "id": "total-employees-block", - - "question": { - "id": "total-employees-question", - "title": { - "text": "On 1st Jan 2021, what was the number of employees for {ru_name}?", - "placeholders": [ - { - "placeholder": "ru_name", - "value": { - "source": "metadata", - "identifier": "ru_name" - } - } - ] - }, - "type": "General", - "answers": [ - { - "id": "total-employees-answer", - "label": "Total employees", - "mandatory": true, - "type": "Number", - "minimum": { - "value": 0, - "exclusive": true - } - } - ] - } - } - ] - } - ] - }, - { - "id": "breakdown-section", - "title": "Breakdown", - "summary": { - "show_on_completion": true - }, - "enabled": { - "when": { - "and": [ - { - "!=": [ - null, - { - "source": "answers", - "identifier": "total-turnover-answer" - } - ] - }, - { - "!=": [ - null, - { - "source": "answers", - "identifier": "total-employees-answer" - } - ] - } - ] - } - }, - "groups": [ - { - "id": "breakdown-group", - "title": "Company breakdown", - "blocks": [ - { - "type": "Question", - "id": "turnover-breakdown-block", - "question": { - "id": "turnover-breakdown-question", - "title": { - "text": "Please breakdown your total turnover of {total_turnover}", - "placeholders": [ - { - "placeholder": "total_turnover", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "source": "answers", - "identifier": "total-turnover-answer" - } - } - } - ] - } - ] - }, - "type": "Calculated", - "warning": "These answers must add up to the total turnover provided in the first section", - "calculations": [ - { - "calculation_type": "sum", - "answer_id": "total-turnover-answer", - "answers_to_calculate": ["turnover-breakdown-1", "turnover-breakdown-2", "turnover-breakdown-3"], - "conditions": ["equals"] - } - ], - "answers": [ - { - "id": "turnover-breakdown-1", - "label": "Cost of sales", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "turnover-breakdown-2", - "label": "Operating expenses", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "turnover-breakdown-3", - "label": "Gross profit", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "employees-breakdown-block", - "question": { - "id": "employees-breakdown-question", - "title": { - "text": "Please breakdown your number of employees of {total_employees}", - "placeholders": [ - { - "placeholder": "total_employees", - "transforms": [ - { - "transform": "format_number", - "arguments": { - "number": { - "source": "answers", - "identifier": "total-employees-answer" - } - } - } - ] - } - ] - }, - "type": "Calculated", - "warning": "These answers must add up to the total employees provided in the first section", - "calculations": [ - { - "calculation_type": "sum", - "answer_id": "total-employees-answer", - "answers_to_calculate": ["employees-breakdown-1", "employees-breakdown-2"], - "conditions": ["equals"] - } - ], - "answers": [ - { - "id": "employees-breakdown-1", - "label": "Male employees", - "mandatory": false, - "type": "Number" - }, - { - "id": "employees-breakdown-2", - "label": "Female employees", - "mandatory": false, - "type": "Number" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_validation_sum_against_total_less_than.json b/schemas/test/en/test_validation_sum_against_total_less_than.json deleted file mode 100644 index a6bf249ff9..0000000000 --- a/schemas/test/en/test_validation_sum_against_total_less_than.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "A test schema to validate a sum of answers are Less Than a given total", - "theme": "default", - "description": "A survey that tests grouped and calculated answers against a total", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "group", - "title": "Validate sum against total", - "blocks": [ - { - "type": "Question", - "id": "total-block", - "question": { - "id": "total-question", - "title": "Total", - "type": "General", - "answers": [ - { - "id": "total-answer", - "label": "Total", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "breakdown-block", - "question": { - "id": "breakdown-question", - "title": "Breakdown", - "type": "Calculated", - "calculations": [ - { - "calculation_type": "sum", - "answer_id": "total-answer", - "answers_to_calculate": ["breakdown-1", "breakdown-2", "breakdown-3", "breakdown-4"], - "conditions": ["less than"] - } - ], - "answers": [ - { - "id": "breakdown-1", - "label": "Breakdown 1", - "mandatory": false, - "decimal_places": 2, - "type": "Currency", - "currency": "GBP" - }, - { - "id": "breakdown-2", - "label": "Breakdown 2", - "mandatory": false, - "decimal_places": 2, - "type": "Currency", - "currency": "GBP" - }, - { - "id": "breakdown-3", - "label": "Breakdown 3", - "mandatory": false, - "decimal_places": 2, - "type": "Currency", - "currency": "GBP" - }, - { - "id": "breakdown-4", - "label": "Breakdown 4", - "mandatory": false, - "decimal_places": 2, - "type": "Currency", - "currency": "GBP" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_validation_sum_against_total_multiple.json b/schemas/test/en/test_validation_sum_against_total_multiple.json deleted file mode 100644 index 285d240284..0000000000 --- a/schemas/test/en/test_validation_sum_against_total_multiple.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Grouped validation against total test survey", - "theme": "default", - "description": "A survey that tests grouped and calculated answers against a total", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "group", - "title": "Validate sum against total", - "blocks": [ - { - "type": "Question", - "id": "total-block", - "question": { - "id": "total-question", - "title": "Total", - "type": "General", - "answers": [ - { - "id": "total-answer", - "label": "Total", - "mandatory": true, - "type": "Number", - "decimal_places": 2, - "minimum": { - "value": 0, - "exclusive": true - } - } - ] - } - }, - { - "type": "Question", - "id": "breakdown-block", - "question": { - "id": "breakdown-question", - "title": "Breakdown", - "type": "Calculated", - "calculations": [ - { - "calculation_type": "sum", - "value": 0, - "answers_to_calculate": ["breakdown-1", "breakdown-2", "breakdown-3", "breakdown-4"], - "conditions": ["equals"] - }, - { - "calculation_type": "sum", - "answer_id": "total-answer", - "answers_to_calculate": ["breakdown-1", "breakdown-2", "breakdown-3", "breakdown-4"], - "conditions": ["equals"] - } - ], - "answers": [ - { - "id": "breakdown-1", - "label": "Breakdown 1", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - }, - { - "id": "breakdown-2", - "label": "Breakdown 2", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - }, - { - "id": "breakdown-3", - "label": "Breakdown 3", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - }, - { - "id": "breakdown-4", - "label": "Breakdown 4", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_validation_sum_against_total_repeating_with_dependent_section.json b/schemas/test/en/test_validation_sum_against_total_repeating_with_dependent_section.json deleted file mode 100644 index faa5d77f3f..0000000000 --- a/schemas/test/en/test_validation_sum_against_total_repeating_with_dependent_section.json +++ /dev/null @@ -1,506 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test Calculated Question - Repeating section", - "theme": "default", - "description": "A questionnaire to test repeating calculated question with total in a separate section using the Hub", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": { "required_completed_sections": ["householders-section", "household-overview-section"] } - }, - "sections": [ - { - "id": "householders-section", - "title": "Householders", - "summary": { - "show_on_completion": true, - "items": [ - { - "type": "List", - "for_list": "people", - "title": "Household members", - "add_link_text": "Add someone to this household", - "empty_list_text": "There are no householders" - } - ] - }, - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "cancel_text": "Don’t need to add anyone else?", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "cancel_text": "Don’t need to change anything?", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "cancel_text": "Don’t need to remove this person?", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "warning": "All of the information about this person will be deleted", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "household-overview-section", - "title": "Household Overview", - "summary": { - "show_on_completion": true - }, - "enabled": { - "when": { - ">": [ - { - "count": [ - { - "source": "list", - "identifier": "people" - } - ] - }, - 0 - ] - } - }, - "groups": [ - { - "id": "household-overview-group", - "title": "Spending", - "blocks": [ - { - "type": "Question", - "id": "total-spending-block", - "question": { - "id": "total-spending-question", - "title": "What is the maximum spending limit for a household member per month (excluding entertainment)?", - "type": "General", - "answers": [ - { - "id": "total-spending-answer", - "label": "Maximum spending", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "minimum": { - "value": 0, - "exclusive": true - } - } - ] - } - }, - { - "type": "Question", - "id": "entertainment-spending-block", - "question": { - "id": "entertainment-spending-question", - "title": "What is the maximum spending limit on entertainment for a household member per month?", - "type": "General", - "answers": [ - { - "id": "entertainment-spending-answer", - "label": "Entertaintment spending", - "mandatory": true, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2, - "minimum": { - "value": 0, - "exclusive": true - } - } - ] - } - } - ] - } - ] - }, - { - "id": "breakdown-section", - "title": "Breakdown", - "summary": { - "show_on_completion": true - }, - "repeat": { - "for_list": "people", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "enabled": { - "when": { - "!=": [ - null, - { - "source": "answers", - "identifier": "total-spending-answer" - } - ] - } - }, - "groups": [ - { - "id": "breakdown-group", - "title": "Household breakdown", - "blocks": [ - { - "id": "breakdown-driving-block", - "question": { - "title": "Would you like to answer a question about your monthly spending?", - "answers": [ - { - "id": "breakdown-driving-answer", - "mandatory": true, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "breakdown-driving-question", - "type": "General" - }, - "type": "Question", - "routing_rules": [ - { - "when": { - "==": [ - { - "source": "answers", - "identifier": "breakdown-driving-answer" - }, - "Yes" - ] - }, - "block": "spending-breakdown-block" - }, - { - "section": "End" - } - ] - }, - { - "type": "Question", - "id": "spending-breakdown-block", - "question": { - "id": "spending-breakdown-question", - "title": { - "text": "How do you spending the monthly budget of {total_spending}?", - "placeholders": [ - { - "placeholder": "total_spending", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "source": "answers", - "identifier": "total-spending-answer" - } - } - } - ] - } - ] - }, - "type": "Calculated", - "warning": "These answers must add up to the total spending limit provided in the first section", - "calculations": [ - { - "calculation_type": "sum", - "answer_id": "total-spending-answer", - "answers_to_calculate": ["spending-breakdown-1", "spending-breakdown-2", "spending-breakdown-3"], - "conditions": ["equals"] - } - ], - "answers": [ - { - "id": "spending-breakdown-1", - "label": "Housing", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "spending-breakdown-2", - "label": "Transportation", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "spending-breakdown-3", - "label": "Loans", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - }, - { - "type": "Question", - "id": "second-spending-breakdown-block", - "question": { - "id": "second-spending-breakdown-question", - "title": { - "text": "How do you spend the monthly entertainment budget of {entertainment}?", - "placeholders": [ - { - "placeholder": "entertainment", - "transforms": [ - { - "transform": "format_currency", - "arguments": { - "number": { - "source": "answers", - "identifier": "entertainment-spending-answer" - } - } - } - ] - } - ] - }, - "type": "Calculated", - "warning": "These answers must add up to the entertainment budget provided in the spending breakdown question", - "calculations": [ - { - "calculation_type": "sum", - "value": { - "source": "answers", - "identifier": "entertainment-spending-answer" - }, - "answers_to_calculate": [ - "second-spending-breakdown-1", - "second-spending-breakdown-2", - "second-spending-breakdown-3", - "second-spending-breakdown-4" - ], - "conditions": ["equals"] - } - ], - "answers": [ - { - "id": "second-spending-breakdown-1", - "label": "Cinema", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "second-spending-breakdown-2", - "label": "Concerts", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "second-spending-breakdown-3", - "label": "Sporting events", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - }, - { - "id": "second-spending-breakdown-4", - "label": "Other", - "mandatory": false, - "type": "Currency", - "currency": "GBP", - "decimal_places": 2 - } - ] - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_validation_sum_against_value_source.json b/schemas/test/en/test_validation_sum_against_value_source.json deleted file mode 100644 index b394a70198..0000000000 --- a/schemas/test/en/test_validation_sum_against_value_source.json +++ /dev/null @@ -1,190 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Calculated question with value sources test survey", - "theme": "default", - "description": "A survey that tests validation against value sources", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "default-section", - "groups": [ - { - "id": "group", - "title": "Validate sum against answer, calculated summary source", - "blocks": [ - { - "type": "Question", - "id": "total-block", - "question": { - "id": "total-question", - "title": "Total", - "description": ["Enter a number to breakdown in subsequent questions and calculated summary."], - "type": "General", - "answers": [ - { - "id": "total-answer", - "label": "Total", - "mandatory": true, - "type": "Number", - "decimal_places": 2, - "minimum": { - "value": 0, - "exclusive": true - } - } - ] - } - }, - { - "type": "Question", - "id": "breakdown-block", - "question": { - "id": "breakdown-question", - "title": "Breakdown validated against an answer value source", - "description": ["This is a breakdown of the total number from the previous question."], - "type": "Calculated", - "calculations": [ - { - "calculation_type": "sum", - "value": { - "source": "answers", - "identifier": "total-answer" - }, - "answers_to_calculate": ["breakdown-1", "breakdown-2", "breakdown-3", "breakdown-4"], - "conditions": ["equals"] - } - ], - "answers": [ - { - "id": "breakdown-1", - "label": "Breakdown 1", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - }, - { - "id": "breakdown-2", - "label": "Breakdown 2", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - }, - { - "id": "breakdown-3", - "label": "Breakdown 3", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - }, - { - "id": "breakdown-4", - "label": "Breakdown 4", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "number-total-playback", - "title": "We calculate the total of number values entered to be %(total)s. Is this correct?", - "calculation": { - "calculation_type": "sum", - "answers_to_calculate": ["breakdown-1", "breakdown-2"], - "title": "Grand total of previous values" - } - }, - { - "type": "Question", - "id": "second-breakdown-block", - "question": { - "id": "second-breakdown-question", - "title": "Breakdown validated against calculated summary value source", - "description": ["This is a breakdown of the grand total from the previous calculated summary."], - "type": "Calculated", - "calculations": [ - { - "calculation_type": "sum", - "value": { - "source": "calculated_summary", - "identifier": "number-total-playback" - }, - "answers_to_calculate": ["second-breakdown-1", "second-breakdown-2", "second-breakdown-3", "second-breakdown-4"], - "conditions": ["equals"] - } - ], - "answers": [ - { - "id": "second-breakdown-1", - "label": "Breakdown 1", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - }, - { - "id": "second-breakdown-2", - "label": "Breakdown 2", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - }, - { - "id": "second-breakdown-3", - "label": "Breakdown 3", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - }, - { - "id": "second-breakdown-4", - "label": "Breakdown 4", - "mandatory": false, - "decimal_places": 2, - "type": "Number" - } - ] - } - }, - { - "type": "CalculatedSummary", - "id": "another-number-total-playback", - "title": "We calculate the total of number values entered to be %(total)s. Is this correct?", - "calculation": { - "calculation_type": "sum", - "answers_to_calculate": ["breakdown-1", "breakdown-2", "breakdown-3", "breakdown-4"], - "title": "Another grand total of previous values" - } - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_variants_content.json b/schemas/test/en/test_variants_content.json deleted file mode 100644 index ccec714151..0000000000 --- a/schemas/test/en/test_variants_content.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test New Content Variants", - "theme": "default", - "description": "A questionnaire to test new content variants and variant choices", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Linear", - "options": { - "summary": { - "collapsible": false - } - } - }, - "sections": [ - { - "id": "section", - "groups": [ - { - "id": "group", - "title": "Variants", - "blocks": [ - { - "type": "Question", - "id": "age-question-block", - "question": { - "id": "age-question", - "type": "General", - "title": "What is your age?", - "answers": [ - { - "id": "age-answer", - "label": "Your age?", - "mandatory": true, - "type": "Number" - } - ] - } - }, - { - "type": "Interstitial", - "id": "age-display-block", - "content_variants": [ - { - "content": { - "title": "You are 16 or older", - "contents": [ - { - "description": "According to your answer" - } - ] - }, - "when": { - ">": [ - { - "source": "answers", - "identifier": "age-answer" - }, - 16 - ] - } - }, - { - "content": { - "title": "You are 16 or younger", - "contents": [ - { - "description": "According to your answer" - } - ] - }, - "when": { - "<=": [ - { - "source": "answers", - "identifier": "age-answer" - }, - 16 - ] - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/schemas/test/en/test_variants_first_item_in_list.json b/schemas/test/en/test_variants_first_item_in_list.json deleted file mode 100644 index 0e3f8f366f..0000000000 --- a/schemas/test/en/test_variants_first_item_in_list.json +++ /dev/null @@ -1,298 +0,0 @@ -{ - "mime_type": "application/json/ons/eq", - "language": "en", - "schema_version": "0.0.1", - "data_version": "0.0.3", - "survey_id": "0", - "title": "Test New Question Variants Using List", - "theme": "default", - "description": "A questionnaire to test new question variants using the first item in a list", - "metadata": [ - { - "name": "user_id", - "type": "string" - }, - { - "name": "period_id", - "type": "string" - }, - { - "name": "ru_name", - "type": "string" - } - ], - "questionnaire_flow": { - "type": "Hub", - "options": {} - }, - "sections": [ - { - "id": "section", - "title": "Household", - "groups": [ - { - "id": "group", - "title": "List", - "blocks": [ - { - "id": "list-collector", - "type": "ListCollector", - "for_list": "people", - "question": { - "id": "confirmation-question", - "type": "General", - "title": "Does anyone else live here?", - "answers": [ - { - "id": "anyone-else", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RedirectToListAddBlock" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - }, - "add_block": { - "id": "add-person", - "type": "ListAddQuestion", - "question": { - "id": "add-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "edit_block": { - "id": "edit-person", - "type": "ListEditQuestion", - "question": { - "id": "edit-question", - "type": "General", - "title": "What is the name of the person?", - "answers": [ - { - "id": "first-name", - "label": "First name", - "mandatory": true, - "type": "TextField" - }, - { - "id": "last-name", - "label": "Last name", - "mandatory": true, - "type": "TextField" - } - ] - } - }, - "remove_block": { - "id": "remove-person", - "type": "ListRemoveQuestion", - "question": { - "id": "remove-question", - "type": "General", - "title": "Are you sure you want to remove this person?", - "answers": [ - { - "id": "remove-confirmation", - "mandatory": true, - "type": "Radio", - "options": [ - { - "label": "Yes", - "value": "Yes", - "action": { - "type": "RemoveListItemAndAnswers" - } - }, - { - "label": "No", - "value": "No" - } - ] - } - ] - } - }, - "summary": { - "title": "Household members", - "item_title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "arguments": { - "delimiter": " ", - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ] - }, - "transform": "concatenate_list" - } - ] - } - ] - } - } - } - ] - } - ] - }, - { - "id": "personal-details-section", - "title": "Personal Details", - "summary": { "show_on_completion": true }, - "repeat": { - "for_list": "people", - "title": { - "text": "{person_name}", - "placeholders": [ - { - "placeholder": "person_name", - "transforms": [ - { - "transform": "concatenate_list", - "arguments": { - "list_to_concatenate": [ - { - "source": "answers", - "identifier": "first-name" - }, - { - "source": "answers", - "identifier": "last-name" - } - ], - "delimiter": " " - } - } - ] - } - ] - } - }, - "groups": [ - { - "id": "personal-details-group", - "title": "Personal Details", - "blocks": [ - { - "id": "list-status", - "question_variants": [ - { - "question": { - "answers": [ - { - "id": "list-status-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "list-status-question", - "title": "You are the first person in the list", - "type": "General" - }, - "when": { - "==": [ - { - "source": "list", - "identifier": "people", - "selector": "first" - }, - { - "source": "location", - "identifier": "list_item_id" - } - ] - } - }, - { - "question": { - "answers": [ - { - "id": "list-status-answer", - "mandatory": false, - "options": [ - { - "label": "Yes", - "value": "Yes" - }, - { - "label": "No", - "value": "No" - } - ], - "type": "Radio" - } - ], - "id": "list-status-question", - "title": "You are not the first person in the list", - "type": "General" - }, - "when": { - "!=": [ - { - "source": "list", - "identifier": "people", - "selector": "first" - }, - { - "source": "location", - "identifier": "list_item_id" - } - ] - } - } - ], - "type": "Question" - } - ] - } - ] - } - ] -} diff --git a/scripts/validate_test_schemas.sh b/scripts/validate_test_schemas.sh index e585590bc6..4b0cba359a 100755 --- a/scripts/validate_test_schemas.sh +++ b/scripts/validate_test_schemas.sh @@ -66,11 +66,11 @@ validate() { N_TIMES_IN_PARALLEL=20 for schema in ${file_path_name}; do - ((i=i%N_TIMES_IN_PARALLEL)); ((i++==0)) && wait + ((i=i%N_TIMES_IN_PARALLEL)); ((i++==0)) # Spawn multiple (N_TIMES_IN_PARALLEL) processes in subshells and send to background, but keep printing outputs. validate "$schema" & done - +wait exit "$exit" From bd76d5f95e9faba25a37b58919314df6430b9f42 Mon Sep 17 00:00:00 2001 From: petechd Date: Wed, 15 Jan 2025 15:51:48 +0000 Subject: [PATCH 02/12] Add bad schema --- .../en/test_view_submitted_response_repeating_sections.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/test/en/test_view_submitted_response_repeating_sections.json b/schemas/test/en/test_view_submitted_response_repeating_sections.json index b0a015ccd5..aff0296116 100644 --- a/schemas/test/en/test_view_submitted_response_repeating_sections.json +++ b/schemas/test/en/test_view_submitted_response_repeating_sections.json @@ -45,7 +45,7 @@ "label": "Full name", "max_length": 20, "mandatory": false, - "type": "TextField" + "type": "TextFieldMock" } ], "id": "name-question", From 5da587ea57181061ed45603b89a246ee1c1d57c1 Mon Sep 17 00:00:00 2001 From: petechd Date: Wed, 15 Jan 2025 15:55:52 +0000 Subject: [PATCH 03/12] Add summary statement --- scripts/validate_test_schemas.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/validate_test_schemas.sh b/scripts/validate_test_schemas.sh index 4b0cba359a..dbeed95f6f 100755 --- a/scripts/validate_test_schemas.sh +++ b/scripts/validate_test_schemas.sh @@ -73,4 +73,6 @@ done wait +echo -e "\\n${green}$passed Passed${default} - ${red}$failed Failed${default}" + exit "$exit" From ade416abf260f85980798a1095a13b72ad96e2f1 Mon Sep 17 00:00:00 2001 From: petechd Date: Wed, 15 Jan 2025 16:01:48 +0000 Subject: [PATCH 04/12] Add echo exit status --- scripts/validate_test_schemas.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/validate_test_schemas.sh b/scripts/validate_test_schemas.sh index dbeed95f6f..eb60a2bb56 100755 --- a/scripts/validate_test_schemas.sh +++ b/scripts/validate_test_schemas.sh @@ -74,5 +74,5 @@ done wait echo -e "\\n${green}$passed Passed${default} - ${red}$failed Failed${default}" - +echo "$exit" exit "$exit" From 96382e240522e71418fdaee752066055e5661b9d Mon Sep 17 00:00:00 2001 From: petechd Date: Wed, 15 Jan 2025 23:06:12 +0000 Subject: [PATCH 05/12] Change scrypt to use python --- Makefile | 2 +- scripts/validate_test_schemas.py | 47 ++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 scripts/validate_test_schemas.py diff --git a/Makefile b/Makefile index 907e145505..02f86ae482 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ generate-spec: poetry run python -m tests.functional.generate_pages schemas/test/en/$(SCHEMA).json ./tests/functional/generated_pages/$(patsubst test_%,%,$(SCHEMA)) -r '../../base_pages' -s tests/functional/spec/$(SCHEMA).spec.js validate-test-schemas: - ./scripts/validate_test_schemas.sh + poetry run python -m scripts.validate_test_schemas validate-test-schema: ./scripts/validate_test_schemas.sh $(SCHEMA_PATH)$(SCHEMA).json diff --git a/scripts/validate_test_schemas.py b/scripts/validate_test_schemas.py new file mode 100644 index 0000000000..5a39331dc6 --- /dev/null +++ b/scripts/validate_test_schemas.py @@ -0,0 +1,47 @@ +import subprocess +import os +import sys +from concurrent.futures import ThreadPoolExecutor, as_completed + +error = False + + +def validate_schema(schema_path): + try: + result = subprocess.run( + ['curl', '-s', '-w', 'HTTPSTATUS:%{http_code}', '-X', 'POST', '-H', 'Content-Type: application/json', '-d', f'@{schema_path}', + 'http://localhost:5001/validate'], + capture_output=True, + text=True, + check=True + ) + return schema_path, result.stdout + except subprocess.CalledProcessError as e: + print(f"Error validating schema {schema_path}: {e}") + return schema_path, None + + +def main(): + file_path = './schemas/test/en' + schemas = [os.path.join(file_path, f) for f in os.listdir(file_path) if f.endswith('.json')] + + with ThreadPoolExecutor(max_workers=20) as executor: + future_to_schema = {executor.submit(validate_schema, schema): schema for schema in schemas} + for future in as_completed(future_to_schema): + schema = future_to_schema[future] + try: + schema_path, result = future.result() + if result == "{}HTTPSTATUS:200": + print(f"Result for {schema_path}: PASSED") + else: + global error + error = True + except Exception as e: + print(f"Error processing {schema}: {e}") + if error: + print("Some schemas failed validation") + sys.exit(1) + + +if __name__ == "__main__": + main() From dd51ef03c6e8b8d346827741687f2e0578746bce Mon Sep 17 00:00:00 2001 From: petechd Date: Wed, 15 Jan 2025 23:11:50 +0000 Subject: [PATCH 06/12] Add poetry --- .github/workflows/pull_request.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 20f0254cc0..99db5061fb 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -115,8 +115,19 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 + - run: | + echo "PYTHON_VERSION=$(cat .python-version)" >> $GITHUB_ENV - name: Run validator run: ./scripts/run_validator.sh + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + version: 1.8.4 + virtualenvs-create: true + - uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} + cache: "poetry" - name: Running schema tests run: make validate-test-schemas test-functional: From 8c4fd2ac6dcf4035942aa811102620e55d552967 Mon Sep 17 00:00:00 2001 From: petechd Date: Wed, 15 Jan 2025 23:39:15 +0000 Subject: [PATCH 07/12] Add colour print statements --- scripts/validate_test_schemas.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/scripts/validate_test_schemas.py b/scripts/validate_test_schemas.py index 5a39331dc6..ab2fdfb94d 100644 --- a/scripts/validate_test_schemas.py +++ b/scripts/validate_test_schemas.py @@ -1,10 +1,13 @@ +import json import subprocess import os +import re import sys from concurrent.futures import ThreadPoolExecutor, as_completed error = False - +passed = 0 +failed = 0 def validate_schema(schema_path): try: @@ -31,15 +34,31 @@ def main(): schema = future_to_schema[future] try: schema_path, result = future.result() - if result == "{}HTTPSTATUS:200": - print(f"Result for {schema_path}: PASSED") + # Extract HTTP body + http_body = re.sub(r'HTTPSTATUS:.*', '', result) + + # Convert HTTP body to JSON + http_body_json = json.loads(http_body) + + # Extract HTTP status code + result_response = re.search(r'HTTPSTATUS:(\d+)', result)[1] + + if result_response == "200" and http_body_json == {}: + print(f"\033[32m{schema_path}: PASSED\033[0m") + global passed + passed += 1 else: + print(f"\033[31m{schema_path}: FAILED") + print(f"HTTP Status @ /validate: {result_response}") + print(f"HTTP Status: {http_body_json}\033[0m") global error error = True + global failed + failed += 1 except Exception as e: print(f"Error processing {schema}: {e}") if error: - print("Some schemas failed validation") + print(f"\033[32m{passed} passed\033[0m - \033[31m{failed} failed\033[0m") sys.exit(1) From 27350024ea4b0c58c752053e7058bebf4bf5eab4 Mon Sep 17 00:00:00 2001 From: petechd Date: Wed, 15 Jan 2025 23:42:55 +0000 Subject: [PATCH 08/12] Fix print statements --- scripts/validate_test_schemas.py | 8 ++++---- scripts/validate_test_schemas.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/validate_test_schemas.py b/scripts/validate_test_schemas.py index ab2fdfb94d..046eac4e14 100644 --- a/scripts/validate_test_schemas.py +++ b/scripts/validate_test_schemas.py @@ -48,15 +48,15 @@ def main(): global passed passed += 1 else: - print(f"\033[31m{schema_path}: FAILED") - print(f"HTTP Status @ /validate: {result_response}") - print(f"HTTP Status: {http_body_json}\033[0m") + print(f"\033[31m{schema_path}: FAILED\033[0m") + print(f"\033[31mHTTP Status @ /validate: {result_response}\033[0m") + print(f"\033[31mHTTP Status: {http_body_json}\033[0m") global error error = True global failed failed += 1 except Exception as e: - print(f"Error processing {schema}: {e}") + print(f"\033[31mError processing {schema}: {e}\033[0m") if error: print(f"\033[32m{passed} passed\033[0m - \033[31m{failed} failed\033[0m") sys.exit(1) diff --git a/scripts/validate_test_schemas.sh b/scripts/validate_test_schemas.sh index eb60a2bb56..6890cef725 100755 --- a/scripts/validate_test_schemas.sh +++ b/scripts/validate_test_schemas.sh @@ -58,7 +58,7 @@ validate() { echo "HTTP Status @ /validate: [$result_response]" echo -e "Error: [$result_body]${default}\\n" (( failed++ )) - exit=1 + return exit 1 fi } From a725c64e795387c6f29c6d75366da1335fbc141d Mon Sep 17 00:00:00 2001 From: petechd Date: Wed, 15 Jan 2025 23:53:27 +0000 Subject: [PATCH 09/12] Add retries and linting --- scripts/validate_test_schemas.py | 51 ++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/scripts/validate_test_schemas.py b/scripts/validate_test_schemas.py index 046eac4e14..028dc0ca3d 100644 --- a/scripts/validate_test_schemas.py +++ b/scripts/validate_test_schemas.py @@ -1,14 +1,16 @@ import json -import subprocess import os import re +import subprocess import sys +import time from concurrent.futures import ThreadPoolExecutor, as_completed error = False passed = 0 failed = 0 + def validate_schema(schema_path): try: result = subprocess.run( @@ -16,7 +18,7 @@ def validate_schema(schema_path): 'http://localhost:5001/validate'], capture_output=True, text=True, - check=True + check=True, ) return schema_path, result.stdout except subprocess.CalledProcessError as e: @@ -25,23 +27,55 @@ def validate_schema(schema_path): def main(): - file_path = './schemas/test/en' - schemas = [os.path.join(file_path, f) for f in os.listdir(file_path) if f.endswith('.json')] + checks = 4 + + while checks > 0: + response = subprocess.run( + ['curl', '-so', '/dev/null', '-w', '%{http_code}', 'http://localhost:5002/status'], + capture_output=True, + text=True + ).stdout.strip() + + if response != "200": + print(f"\033[31m---Error: Schema Validator Not Reachable---\033[0m") + print(f"\033[31mHTTP Status: {response}\033[0m") + if checks != 1: + print(f"Retrying...\n") + time.sleep(5) + else: + print(f"Exiting...\n") + sys.exit(1) + checks -= 1 + else: + checks = 0 + + if len(sys.argv) == 1 or sys.argv[1] == "--local": + file_path = "./schemas/test/en" + else: + file_path = sys.argv[1] + + print(f"--- Testing Schemas in {file_path} ---") + + schemas = [ + os.path.join(file_path, f) for f in os.listdir(file_path) if f.endswith(".json") + ] with ThreadPoolExecutor(max_workers=20) as executor: - future_to_schema = {executor.submit(validate_schema, schema): schema for schema in schemas} + future_to_schema = { + executor.submit(validate_schema, schema): schema for schema in schemas + } for future in as_completed(future_to_schema): schema = future_to_schema[future] try: schema_path, result = future.result() # Extract HTTP body - http_body = re.sub(r'HTTPSTATUS:.*', '', result) + http_body = re.sub(r"HTTPSTATUS:.*", "", result) # Convert HTTP body to JSON http_body_json = json.loads(http_body) # Extract HTTP status code - result_response = re.search(r'HTTPSTATUS:(\d+)', result)[1] + result_response = re.search(r"HTTPSTATUS:(\d+)", result)[1] if result_response == "200" and http_body_json == {}: print(f"\033[32m{schema_path}: PASSED\033[0m") @@ -51,9 +85,8 @@ def main(): print(f"\033[31m{schema_path}: FAILED\033[0m") print(f"\033[31mHTTP Status @ /validate: {result_response}\033[0m") print(f"\033[31mHTTP Status: {http_body_json}\033[0m") - global error + global error, failed error = True - global failed failed += 1 except Exception as e: print(f"\033[31mError processing {schema}: {e}\033[0m") From 5786a00013817750373104f2f91f8d5cee779af8 Mon Sep 17 00:00:00 2001 From: petechd Date: Wed, 15 Jan 2025 23:56:40 +0000 Subject: [PATCH 10/12] Fix schema --- .../en/test_view_submitted_response_repeating_sections.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/test/en/test_view_submitted_response_repeating_sections.json b/schemas/test/en/test_view_submitted_response_repeating_sections.json index aff0296116..b0a015ccd5 100644 --- a/schemas/test/en/test_view_submitted_response_repeating_sections.json +++ b/schemas/test/en/test_view_submitted_response_repeating_sections.json @@ -45,7 +45,7 @@ "label": "Full name", "max_length": 20, "mandatory": false, - "type": "TextFieldMock" + "type": "TextField" } ], "id": "name-question", From 6bbdbd9e9228ce2af9a221a0584c3c456f7b2eea Mon Sep 17 00:00:00 2001 From: petechd Date: Thu, 16 Jan 2025 00:09:03 +0000 Subject: [PATCH 11/12] Add linting --- scripts/validate_test_schemas.py | 34 +++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/scripts/validate_test_schemas.py b/scripts/validate_test_schemas.py index 028dc0ca3d..334a0c9588 100644 --- a/scripts/validate_test_schemas.py +++ b/scripts/validate_test_schemas.py @@ -14,8 +14,19 @@ def validate_schema(schema_path): try: result = subprocess.run( - ['curl', '-s', '-w', 'HTTPSTATUS:%{http_code}', '-X', 'POST', '-H', 'Content-Type: application/json', '-d', f'@{schema_path}', - 'http://localhost:5001/validate'], + [ + "curl", + "-s", + "-w", + "HTTPSTATUS:%{http_code}", + "-X", + "POST", + "-H", + "Content-Type: application/json", + "-d", + f"@{schema_path}", + "http://localhost:5001/validate", + ], capture_output=True, text=True, check=True, @@ -27,23 +38,32 @@ def validate_schema(schema_path): def main(): + # pylint: disable=global-statement, broad-exception-caught checks = 4 while checks > 0: response = subprocess.run( - ['curl', '-so', '/dev/null', '-w', '%{http_code}', 'http://localhost:5002/status'], + [ + "curl", + "-so", + "/dev/null", + "-w", + "%{http_code}", + "http://localhost:5002/status", + ], capture_output=True, - text=True + text=True, + check=False, ).stdout.strip() if response != "200": - print(f"\033[31m---Error: Schema Validator Not Reachable---\033[0m") + print("\033[31m---Error: Schema Validator Not Reachable---\033[0m") print(f"\033[31mHTTP Status: {response}\033[0m") if checks != 1: - print(f"Retrying...\n") + print("Retrying...\n") time.sleep(5) else: - print(f"Exiting...\n") + print("Exiting...\n") sys.exit(1) checks -= 1 else: From 27b2aaae311e7b414295003971e365718a8c77bf Mon Sep 17 00:00:00 2001 From: petechd Date: Thu, 16 Jan 2025 00:19:33 +0000 Subject: [PATCH 12/12] Add back schemas --- .../test_checkbox_detail_answer_dropdown.json | 128 ++ .../test_checkbox_detail_answer_multiple.json | 116 + .../test_checkbox_detail_answer_numeric.json | 96 + ...test_checkbox_detail_answer_textfield.json | 198 ++ .../test/en/test_checkbox_instruction.json | 168 ++ .../en/test_conditional_combined_routing.json | 147 ++ schemas/test/en/test_confirmation_email.json | 75 + .../test/en/test_confirmation_question.json | 220 ++ ...nfirmation_question_backwards_routing.json | 190 ++ ...ion_question_within_repeating_section.json | 491 +++++ schemas/test/en/test_currency.json | 190 ++ schemas/test/en/test_custom_page_titles.json | 1096 +++++++++ .../test/en/test_custom_question_summary.json | 153 ++ schemas/test/en/test_date_range.json | 68 + .../en/test_date_validation_combined.json | 153 ++ ...test_date_validation_mm_yyyy_combined.json | 153 ++ .../test/en/test_date_validation_range.json | 84 + .../test/en/test_date_validation_single.json | 165 ++ .../test_date_validation_yyyy_combined.json | 153 ++ schemas/test/en/test_dates.json | 135 ++ schemas/test/en/test_default.json | 79 + schemas/test/en/test_default_with_skip.json | 119 + schemas/test/en/test_dob_date.json | 213 ++ schemas/test/en/test_dropdown_mandatory.json | 76 + ...pdown_mandatory_with_overridden_error.json | 80 + schemas/test/en/test_dropdown_optional.json | 76 + schemas/test/en/test_durations.json | 97 + ...ynamic_answer_options_function_driven.json | 346 +++ ...s_function_driven_with_static_options.json | 370 ++++ ..._driven_with_static_options_mandatory.json | 370 ++++ .../en/test_dynamic_answers_list_source.json | 588 +++++ ...t_dynamic_radio_options_from_checkbox.json | 134 ++ schemas/test/en/test_feedback.json | 74 + .../en/test_feedback_email_confirmation.json | 74 + .../en/test_grand_calculated_summary.json | 294 +++ ...ed_summary_cross_section_dependencies.json | 368 ++++ ...ated_summary_inside_repeating_section.json | 1109 ++++++++++ ...alculated_summary_overlapping_answers.json | 357 +++ ..._calculated_summary_repeating_answers.json | 1426 ++++++++++++ schemas/test/en/test_hub_and_spoke.json | 319 +++ .../en/test_hub_and_spoke_custom_content.json | 118 + .../test/en/test_hub_complete_sections.json | 198 ++ ...test_hub_section_required_and_enabled.json | 122 ++ ...test_hub_section_required_with_repeat.json | 431 ++++ ...on_required_with_repeat_supplementary.json | 414 ++++ schemas/test/en/test_individual_response.json | 626 ++++++ ...t_individual_response_on_hub_disabled.json | 448 ++++ schemas/test/en/test_instructions.json | 81 + .../test/en/test_interstitial_definition.json | 170 ++ schemas/test/en/test_interstitial_page.json | 96 + .../test/en/test_interstitial_page_title.json | 64 + schemas/test/en/test_interviewer_note.json | 115 + schemas/test/en/test_introduction.json | 720 ++++++ schemas/test/en/test_introduction_hub.json | 636 ++++++ schemas/test/en/test_language.json | 246 +++ .../test_last_viewed_question_guidance.json | 976 +++++++++ ...est_last_viewed_question_guidance_hub.json | 235 ++ .../test_list_change_evaluates_sections.json | 352 +++ schemas/test/en/test_list_collector.json | 344 +++ .../en/test_list_collector_content_page.json | 550 +++++ .../test_list_collector_driving_checkbox.json | 699 ++++++ .../test_list_collector_driving_question.json | 251 +++ .../en/test_list_collector_list_summary.json | 528 +++++ ...y_and_collector_with_driving_question.json | 304 +++ .../test_list_collector_primary_person.json | 341 +++ ...ctor_repeating_blocks_section_summary.json | 432 ++++ ...t_collector_repeating_blocks_with_hub.json | 826 +++++++ .../test_list_collector_same_name_items.json | 394 ++++ .../test_list_collector_section_summary.json | 549 +++++ ...st_list_collector_two_list_collectors.json | 436 ++++ .../test/en/test_list_collector_variants.json | 385 ++++ ...ist_collector_variants_primary_person.json | 368 ++++ ...st_collector_variants_section_summary.json | 551 +++++ .../en/test_list_summary_on_question.json | 401 ++++ schemas/test/en/test_markup.json | 74 + schemas/test/en/test_metadata_routing.json | 117 + schemas/test/en/test_mobile_number.json | 61 + schemas/test/en/test_multiple_answers.json | 217 ++ schemas/test/en/test_multiple_piping.json | 244 +++ schemas/test/en/test_mutually_exclusive.json | 573 +++++ .../en/test_mutually_exclusive_multiple.json | 622 ++++++ .../test/en/test_new_calculated_summary.json | 571 +++++ ...ed_summary_cross_section_dependencies.json | 375 ++++ ..._cross_section_dependencies_repeating.json | 603 +++++ ...alculated_summary_dependent_questions.json | 176 ++ ..._summary_repeating_and_static_answers.json | 727 ++++++ ...ulated_summary_repeating_answers_only.json | 322 +++ ...w_calculated_summary_repeating_blocks.json | 521 +++++ ..._calculated_summary_repeating_section.json | 820 +++++++ schemas/test/en/test_numbers.json | 547 +++++ ...est_optional_guidance_and_description.json | 219 ++ schemas/test/en/test_percentage.json | 91 + ...aceholder_based_on_first_item_in_list.json | 386 ++++ .../en/test_placeholder_default_value.json | 169 ++ ...pendencies_with_calculation_summaries.json | 647 ++++++ .../test_placeholder_difference_in_years.json | 127 ++ ...holder_difference_in_years_month_year.json | 127 ++ ..._difference_in_years_month_year_range.json | 134 ++ ...placeholder_difference_in_years_range.json | 134 ++ ...test_placeholder_first_non_empty_item.json | 275 +++ ...empty_item_cross_section_dependencies.json | 283 +++ ...rst_non_empty_item_repeating_sections.json | 528 +++++ schemas/test/en/test_placeholder_full.json | 341 +++ .../test/en/test_placeholder_metadata.json | 85 + ...t_placeholder_option_label_from_value.json | 151 ++ .../en/test_placeholder_playback_list.json | 164 ++ .../test/en/test_placeholder_transform.json | 336 +++ ...aceholder_transform_date_range_bounds.json | 174 ++ schemas/test/en/test_plural_forms.json | 135 ++ ...block_value_source_repeating_sections.json | 392 ++++ ...ction_value_source_repeating_sections.json | 392 ++++ .../en/test_progress_value_source_blocks.json | 210 ++ ...ess_value_source_blocks_cross_section.json | 224 ++ ...gress_value_source_calculated_summary.json | 517 +++++ ...ue_source_calculated_summary_extended.json | 1129 ++++++++++ ...peating_sections_chained_dependencies.json | 490 +++++ ...ress_value_source_section_enabled_hub.json | 110 + ...ue_source_section_enabled_hub_complex.json | 251 +++ ...s_value_source_section_enabled_no_hub.json | 114 + schemas/test/en/test_question_definition.json | 78 + .../test_question_definition_array_type.json | 80 + .../test/en/test_question_description.json | 69 + schemas/test/en/test_question_guidance.json | 310 +++ .../test/en/test_question_title_in_error.json | 160 ++ .../en/test_radio_checkbox_descriptions.json | 126 ++ .../en/test_radio_detail_answer_dropdown.json | 128 ++ .../en/test_radio_detail_answer_multiple.json | 92 + .../en/test_radio_detail_answer_numeric.json | 95 + .../en/test_radio_detail_answer_visible.json | 147 ++ schemas/test/en/test_radio_mandatory.json | 74 + ...andatory_with_detail_answer_mandatory.json | 77 + ...nswer_mandatory_with_overridden_error.json | 82 + ...mandatory_with_detail_answer_optional.json | 77 + ...radio_mandatory_with_overridden_error.json | 75 + schemas/test/en/test_radio_optional.json | 70 + ...optional_with_detail_answer_mandatory.json | 77 + ...nswer_mandatory_with_overridden_error.json | 82 + ..._optional_with_detail_answer_optional.json | 77 + schemas/test/en/test_radio_voluntary.json | 98 + ...dio_voluntary_with_repeating_sections.json | 245 +++ schemas/test/en/test_relationships.json | 934 ++++++++ .../test/en/test_relationships_primary.json | 1364 ++++++++++++ .../test/en/test_relationships_unrelated.json | 855 ++++++++ .../en/test_repeating_section_summaries.json | 411 ++++ ...repeating_sections_with_hub_and_spoke.json | 1312 +++++++++++ schemas/test/en/test_routing_and.json | 180 ++ ...ing_and_skipping_section_dependencies.json | 707 ++++++ ...ction_dependencies_calculated_summary.json | 338 +++ ...n_dependencies_new_calculated_summary.json | 360 +++ .../en/test_routing_answer_comparison.json | 124 ++ .../en/test_routing_answered_unanswered.json | 242 ++ ...t_routing_case_insensitive_text_field.json | 125 ++ .../en/test_routing_checkbox_contains.json | 131 ++ .../test_routing_checkbox_contains_all.json | 137 ++ .../test_routing_checkbox_contains_any.json | 137 ++ .../en/test_routing_checkbox_contains_in.json | 137 ++ .../test/en/test_routing_checkbox_count.json | 169 ++ schemas/test/en/test_routing_date_equals.json | 311 +++ .../en/test_routing_date_greater_than.json | 168 ++ ...t_routing_date_greater_than_or_equals.json | 149 ++ .../test/en/test_routing_date_less_than.json | 108 + ...test_routing_date_less_than_or_equals.json | 108 + .../test/en/test_routing_date_not_equals.json | 108 + schemas/test/en/test_routing_group.json | 137 ++ schemas/test/en/test_routing_not.json | 124 ++ ...g_not_affected_by_answers_not_on_path.json | 197 ++ .../test/en/test_routing_number_equals.json | 129 ++ .../en/test_routing_number_greater_than.json | 129 ++ ..._routing_number_greater_than_or_equal.json | 129 ++ ...reater_than_or_equal_single_condition.json | 129 ++ .../en/test_routing_number_less_than.json | 129 ++ ...est_routing_number_less_than_or_equal.json | 129 ++ ...r_less_than_or_equal_single_condition.json | 129 ++ .../en/test_routing_number_not_equals.json | 129 ++ .../en/test_routing_on_multiple_select.json | 126 ++ schemas/test/en/test_routing_or.json | 180 ++ ...o_questionnaire_end_multiple_sections.json | 152 ++ ...g_to_questionnaire_end_single_section.json | 135 ++ .../test/en/test_routing_to_section_end.json | 204 ++ .../en/test_section_enabled_checkbox.json | 168 ++ schemas/test/en/test_section_enabled_hub.json | 163 ++ .../test/en/test_section_enabled_radio.json | 115 + schemas/test/en/test_section_summary.json | 284 +++ ...st_show_section_summary_on_completion.json | 201 ++ ...test_skip_condition_answer_comparison.json | 157 ++ .../test/en/test_skip_condition_block.json | 100 + .../test/en/test_skip_condition_group.json | 106 + schemas/test/en/test_skip_condition_list.json | 272 +++ .../test/en/test_skip_condition_not_set.json | 110 + schemas/test/en/test_skip_condition_set.json | 110 + ...st_submit_with_custom_submission_text.json | 72 + schemas/test/en/test_submit_with_summary.json | 191 ++ ...t_with_summary_custom_submission_text.json | 69 + ..._submit_with_summary_return_to_answer.json | 233 ++ schemas/test/en/test_supplementary_data.json | 1950 +++++++++++++++++ schemas/test/en/test_textarea.json | 73 + schemas/test/en/test_textfield.json | 67 + .../test/en/test_textfield_suggestions.json | 86 + schemas/test/en/test_thank_you.json | 83 + schemas/test/en/test_theme_dbt.json | 75 + schemas/test/en/test_theme_dbt_dsit.json | 75 + schemas/test/en/test_theme_dbt_dsit_ni.json | 75 + schemas/test/en/test_theme_dbt_ni.json | 75 + schemas/test/en/test_theme_desnz.json | 75 + schemas/test/en/test_theme_desnz_ni.json | 75 + schemas/test/en/test_theme_health.json | 70 + .../test/en/test_theme_northernireland.json | 75 + schemas/test/en/test_theme_ons_nhs.json | 75 + schemas/test/en/test_theme_orr.json | 75 + schemas/test/en/test_theme_social.json | 71 + schemas/test/en/test_theme_ukhsa_ons.json | 75 + schemas/test/en/test_timeout.json | 63 + schemas/test/en/test_timeout_modal.json | 58 + schemas/test/en/test_title.json | 70 + .../en/test_titles_radio_and_checkbox.json | 353 +++ schemas/test/en/test_unit_patterns.json | 277 +++ ...ion_sum_against_total_dynamic_answers.json | 470 ++++ ...st_validation_sum_against_total_equal.json | 111 + ..._sum_against_total_equal_or_less_than.json | 110 + ...inst_total_hub_with_dependent_section.json | 252 +++ ...alidation_sum_against_total_less_than.json | 115 + ...validation_sum_against_total_multiple.json | 120 + ...otal_repeating_with_dependent_section.json | 506 +++++ ...t_validation_sum_against_value_source.json | 190 ++ schemas/test/en/test_variants_content.json | 106 + .../en/test_variants_first_item_in_list.json | 298 +++ 226 files changed, 60881 insertions(+) create mode 100644 schemas/test/en/test_checkbox_detail_answer_dropdown.json create mode 100644 schemas/test/en/test_checkbox_detail_answer_multiple.json create mode 100644 schemas/test/en/test_checkbox_detail_answer_numeric.json create mode 100644 schemas/test/en/test_checkbox_detail_answer_textfield.json create mode 100644 schemas/test/en/test_checkbox_instruction.json create mode 100644 schemas/test/en/test_conditional_combined_routing.json create mode 100644 schemas/test/en/test_confirmation_email.json create mode 100644 schemas/test/en/test_confirmation_question.json create mode 100644 schemas/test/en/test_confirmation_question_backwards_routing.json create mode 100644 schemas/test/en/test_confirmation_question_within_repeating_section.json create mode 100644 schemas/test/en/test_currency.json create mode 100644 schemas/test/en/test_custom_page_titles.json create mode 100644 schemas/test/en/test_custom_question_summary.json create mode 100644 schemas/test/en/test_date_range.json create mode 100644 schemas/test/en/test_date_validation_combined.json create mode 100644 schemas/test/en/test_date_validation_mm_yyyy_combined.json create mode 100644 schemas/test/en/test_date_validation_range.json create mode 100644 schemas/test/en/test_date_validation_single.json create mode 100644 schemas/test/en/test_date_validation_yyyy_combined.json create mode 100644 schemas/test/en/test_dates.json create mode 100644 schemas/test/en/test_default.json create mode 100644 schemas/test/en/test_default_with_skip.json create mode 100644 schemas/test/en/test_dob_date.json create mode 100644 schemas/test/en/test_dropdown_mandatory.json create mode 100644 schemas/test/en/test_dropdown_mandatory_with_overridden_error.json create mode 100644 schemas/test/en/test_dropdown_optional.json create mode 100644 schemas/test/en/test_durations.json create mode 100644 schemas/test/en/test_dynamic_answer_options_function_driven.json create mode 100644 schemas/test/en/test_dynamic_answer_options_function_driven_with_static_options.json create mode 100644 schemas/test/en/test_dynamic_answer_options_function_driven_with_static_options_mandatory.json create mode 100644 schemas/test/en/test_dynamic_answers_list_source.json create mode 100644 schemas/test/en/test_dynamic_radio_options_from_checkbox.json create mode 100644 schemas/test/en/test_feedback.json create mode 100644 schemas/test/en/test_feedback_email_confirmation.json create mode 100644 schemas/test/en/test_grand_calculated_summary.json create mode 100644 schemas/test/en/test_grand_calculated_summary_cross_section_dependencies.json create mode 100644 schemas/test/en/test_grand_calculated_summary_inside_repeating_section.json create mode 100644 schemas/test/en/test_grand_calculated_summary_overlapping_answers.json create mode 100644 schemas/test/en/test_grand_calculated_summary_repeating_answers.json create mode 100644 schemas/test/en/test_hub_and_spoke.json create mode 100644 schemas/test/en/test_hub_and_spoke_custom_content.json create mode 100644 schemas/test/en/test_hub_complete_sections.json create mode 100644 schemas/test/en/test_hub_section_required_and_enabled.json create mode 100644 schemas/test/en/test_hub_section_required_with_repeat.json create mode 100644 schemas/test/en/test_hub_section_required_with_repeat_supplementary.json create mode 100644 schemas/test/en/test_individual_response.json create mode 100644 schemas/test/en/test_individual_response_on_hub_disabled.json create mode 100644 schemas/test/en/test_instructions.json create mode 100644 schemas/test/en/test_interstitial_definition.json create mode 100644 schemas/test/en/test_interstitial_page.json create mode 100644 schemas/test/en/test_interstitial_page_title.json create mode 100644 schemas/test/en/test_interviewer_note.json create mode 100644 schemas/test/en/test_introduction.json create mode 100644 schemas/test/en/test_introduction_hub.json create mode 100644 schemas/test/en/test_language.json create mode 100644 schemas/test/en/test_last_viewed_question_guidance.json create mode 100644 schemas/test/en/test_last_viewed_question_guidance_hub.json create mode 100644 schemas/test/en/test_list_change_evaluates_sections.json create mode 100644 schemas/test/en/test_list_collector.json create mode 100644 schemas/test/en/test_list_collector_content_page.json create mode 100644 schemas/test/en/test_list_collector_driving_checkbox.json create mode 100644 schemas/test/en/test_list_collector_driving_question.json create mode 100644 schemas/test/en/test_list_collector_list_summary.json create mode 100644 schemas/test/en/test_list_collector_primary_and_collector_with_driving_question.json create mode 100644 schemas/test/en/test_list_collector_primary_person.json create mode 100644 schemas/test/en/test_list_collector_repeating_blocks_section_summary.json create mode 100644 schemas/test/en/test_list_collector_repeating_blocks_with_hub.json create mode 100644 schemas/test/en/test_list_collector_same_name_items.json create mode 100644 schemas/test/en/test_list_collector_section_summary.json create mode 100644 schemas/test/en/test_list_collector_two_list_collectors.json create mode 100644 schemas/test/en/test_list_collector_variants.json create mode 100644 schemas/test/en/test_list_collector_variants_primary_person.json create mode 100644 schemas/test/en/test_list_collector_variants_section_summary.json create mode 100644 schemas/test/en/test_list_summary_on_question.json create mode 100644 schemas/test/en/test_markup.json create mode 100644 schemas/test/en/test_metadata_routing.json create mode 100644 schemas/test/en/test_mobile_number.json create mode 100644 schemas/test/en/test_multiple_answers.json create mode 100644 schemas/test/en/test_multiple_piping.json create mode 100644 schemas/test/en/test_mutually_exclusive.json create mode 100644 schemas/test/en/test_mutually_exclusive_multiple.json create mode 100644 schemas/test/en/test_new_calculated_summary.json create mode 100644 schemas/test/en/test_new_calculated_summary_cross_section_dependencies.json create mode 100644 schemas/test/en/test_new_calculated_summary_cross_section_dependencies_repeating.json create mode 100644 schemas/test/en/test_new_calculated_summary_dependent_questions.json create mode 100644 schemas/test/en/test_new_calculated_summary_repeating_and_static_answers.json create mode 100644 schemas/test/en/test_new_calculated_summary_repeating_answers_only.json create mode 100644 schemas/test/en/test_new_calculated_summary_repeating_blocks.json create mode 100644 schemas/test/en/test_new_calculated_summary_repeating_section.json create mode 100644 schemas/test/en/test_numbers.json create mode 100644 schemas/test/en/test_optional_guidance_and_description.json create mode 100644 schemas/test/en/test_percentage.json create mode 100644 schemas/test/en/test_placeholder_based_on_first_item_in_list.json create mode 100644 schemas/test/en/test_placeholder_default_value.json create mode 100644 schemas/test/en/test_placeholder_dependencies_with_calculation_summaries.json create mode 100644 schemas/test/en/test_placeholder_difference_in_years.json create mode 100644 schemas/test/en/test_placeholder_difference_in_years_month_year.json create mode 100644 schemas/test/en/test_placeholder_difference_in_years_month_year_range.json create mode 100644 schemas/test/en/test_placeholder_difference_in_years_range.json create mode 100644 schemas/test/en/test_placeholder_first_non_empty_item.json create mode 100644 schemas/test/en/test_placeholder_first_non_empty_item_cross_section_dependencies.json create mode 100644 schemas/test/en/test_placeholder_first_non_empty_item_repeating_sections.json create mode 100644 schemas/test/en/test_placeholder_full.json create mode 100644 schemas/test/en/test_placeholder_metadata.json create mode 100644 schemas/test/en/test_placeholder_option_label_from_value.json create mode 100644 schemas/test/en/test_placeholder_playback_list.json create mode 100644 schemas/test/en/test_placeholder_transform.json create mode 100644 schemas/test/en/test_placeholder_transform_date_range_bounds.json create mode 100644 schemas/test/en/test_plural_forms.json create mode 100644 schemas/test/en/test_progress_block_value_source_repeating_sections.json create mode 100644 schemas/test/en/test_progress_section_value_source_repeating_sections.json create mode 100644 schemas/test/en/test_progress_value_source_blocks.json create mode 100644 schemas/test/en/test_progress_value_source_blocks_cross_section.json create mode 100644 schemas/test/en/test_progress_value_source_calculated_summary.json create mode 100644 schemas/test/en/test_progress_value_source_calculated_summary_extended.json create mode 100644 schemas/test/en/test_progress_value_source_repeating_sections_chained_dependencies.json create mode 100644 schemas/test/en/test_progress_value_source_section_enabled_hub.json create mode 100644 schemas/test/en/test_progress_value_source_section_enabled_hub_complex.json create mode 100644 schemas/test/en/test_progress_value_source_section_enabled_no_hub.json create mode 100644 schemas/test/en/test_question_definition.json create mode 100644 schemas/test/en/test_question_definition_array_type.json create mode 100644 schemas/test/en/test_question_description.json create mode 100644 schemas/test/en/test_question_guidance.json create mode 100644 schemas/test/en/test_question_title_in_error.json create mode 100644 schemas/test/en/test_radio_checkbox_descriptions.json create mode 100644 schemas/test/en/test_radio_detail_answer_dropdown.json create mode 100644 schemas/test/en/test_radio_detail_answer_multiple.json create mode 100644 schemas/test/en/test_radio_detail_answer_numeric.json create mode 100644 schemas/test/en/test_radio_detail_answer_visible.json create mode 100644 schemas/test/en/test_radio_mandatory.json create mode 100644 schemas/test/en/test_radio_mandatory_with_detail_answer_mandatory.json create mode 100644 schemas/test/en/test_radio_mandatory_with_detail_answer_mandatory_with_overridden_error.json create mode 100644 schemas/test/en/test_radio_mandatory_with_detail_answer_optional.json create mode 100644 schemas/test/en/test_radio_mandatory_with_overridden_error.json create mode 100644 schemas/test/en/test_radio_optional.json create mode 100644 schemas/test/en/test_radio_optional_with_detail_answer_mandatory.json create mode 100644 schemas/test/en/test_radio_optional_with_detail_answer_mandatory_with_overridden_error.json create mode 100644 schemas/test/en/test_radio_optional_with_detail_answer_optional.json create mode 100644 schemas/test/en/test_radio_voluntary.json create mode 100644 schemas/test/en/test_radio_voluntary_with_repeating_sections.json create mode 100644 schemas/test/en/test_relationships.json create mode 100644 schemas/test/en/test_relationships_primary.json create mode 100644 schemas/test/en/test_relationships_unrelated.json create mode 100644 schemas/test/en/test_repeating_section_summaries.json create mode 100644 schemas/test/en/test_repeating_sections_with_hub_and_spoke.json create mode 100644 schemas/test/en/test_routing_and.json create mode 100644 schemas/test/en/test_routing_and_skipping_section_dependencies.json create mode 100644 schemas/test/en/test_routing_and_skipping_section_dependencies_calculated_summary.json create mode 100644 schemas/test/en/test_routing_and_skipping_section_dependencies_new_calculated_summary.json create mode 100644 schemas/test/en/test_routing_answer_comparison.json create mode 100644 schemas/test/en/test_routing_answered_unanswered.json create mode 100644 schemas/test/en/test_routing_case_insensitive_text_field.json create mode 100644 schemas/test/en/test_routing_checkbox_contains.json create mode 100644 schemas/test/en/test_routing_checkbox_contains_all.json create mode 100644 schemas/test/en/test_routing_checkbox_contains_any.json create mode 100644 schemas/test/en/test_routing_checkbox_contains_in.json create mode 100644 schemas/test/en/test_routing_checkbox_count.json create mode 100644 schemas/test/en/test_routing_date_equals.json create mode 100644 schemas/test/en/test_routing_date_greater_than.json create mode 100644 schemas/test/en/test_routing_date_greater_than_or_equals.json create mode 100644 schemas/test/en/test_routing_date_less_than.json create mode 100644 schemas/test/en/test_routing_date_less_than_or_equals.json create mode 100644 schemas/test/en/test_routing_date_not_equals.json create mode 100644 schemas/test/en/test_routing_group.json create mode 100644 schemas/test/en/test_routing_not.json create mode 100644 schemas/test/en/test_routing_not_affected_by_answers_not_on_path.json create mode 100644 schemas/test/en/test_routing_number_equals.json create mode 100644 schemas/test/en/test_routing_number_greater_than.json create mode 100644 schemas/test/en/test_routing_number_greater_than_or_equal.json create mode 100644 schemas/test/en/test_routing_number_greater_than_or_equal_single_condition.json create mode 100644 schemas/test/en/test_routing_number_less_than.json create mode 100644 schemas/test/en/test_routing_number_less_than_or_equal.json create mode 100644 schemas/test/en/test_routing_number_less_than_or_equal_single_condition.json create mode 100644 schemas/test/en/test_routing_number_not_equals.json create mode 100644 schemas/test/en/test_routing_on_multiple_select.json create mode 100644 schemas/test/en/test_routing_or.json create mode 100644 schemas/test/en/test_routing_to_questionnaire_end_multiple_sections.json create mode 100644 schemas/test/en/test_routing_to_questionnaire_end_single_section.json create mode 100644 schemas/test/en/test_routing_to_section_end.json create mode 100644 schemas/test/en/test_section_enabled_checkbox.json create mode 100644 schemas/test/en/test_section_enabled_hub.json create mode 100644 schemas/test/en/test_section_enabled_radio.json create mode 100644 schemas/test/en/test_section_summary.json create mode 100644 schemas/test/en/test_show_section_summary_on_completion.json create mode 100644 schemas/test/en/test_skip_condition_answer_comparison.json create mode 100644 schemas/test/en/test_skip_condition_block.json create mode 100644 schemas/test/en/test_skip_condition_group.json create mode 100644 schemas/test/en/test_skip_condition_list.json create mode 100644 schemas/test/en/test_skip_condition_not_set.json create mode 100644 schemas/test/en/test_skip_condition_set.json create mode 100644 schemas/test/en/test_submit_with_custom_submission_text.json create mode 100644 schemas/test/en/test_submit_with_summary.json create mode 100644 schemas/test/en/test_submit_with_summary_custom_submission_text.json create mode 100644 schemas/test/en/test_submit_with_summary_return_to_answer.json create mode 100644 schemas/test/en/test_supplementary_data.json create mode 100644 schemas/test/en/test_textarea.json create mode 100644 schemas/test/en/test_textfield.json create mode 100644 schemas/test/en/test_textfield_suggestions.json create mode 100644 schemas/test/en/test_thank_you.json create mode 100644 schemas/test/en/test_theme_dbt.json create mode 100644 schemas/test/en/test_theme_dbt_dsit.json create mode 100644 schemas/test/en/test_theme_dbt_dsit_ni.json create mode 100644 schemas/test/en/test_theme_dbt_ni.json create mode 100644 schemas/test/en/test_theme_desnz.json create mode 100644 schemas/test/en/test_theme_desnz_ni.json create mode 100644 schemas/test/en/test_theme_health.json create mode 100644 schemas/test/en/test_theme_northernireland.json create mode 100644 schemas/test/en/test_theme_ons_nhs.json create mode 100644 schemas/test/en/test_theme_orr.json create mode 100644 schemas/test/en/test_theme_social.json create mode 100644 schemas/test/en/test_theme_ukhsa_ons.json create mode 100644 schemas/test/en/test_timeout.json create mode 100644 schemas/test/en/test_timeout_modal.json create mode 100644 schemas/test/en/test_title.json create mode 100644 schemas/test/en/test_titles_radio_and_checkbox.json create mode 100644 schemas/test/en/test_unit_patterns.json create mode 100644 schemas/test/en/test_validation_sum_against_total_dynamic_answers.json create mode 100644 schemas/test/en/test_validation_sum_against_total_equal.json create mode 100644 schemas/test/en/test_validation_sum_against_total_equal_or_less_than.json create mode 100644 schemas/test/en/test_validation_sum_against_total_hub_with_dependent_section.json create mode 100644 schemas/test/en/test_validation_sum_against_total_less_than.json create mode 100644 schemas/test/en/test_validation_sum_against_total_multiple.json create mode 100644 schemas/test/en/test_validation_sum_against_total_repeating_with_dependent_section.json create mode 100644 schemas/test/en/test_validation_sum_against_value_source.json create mode 100644 schemas/test/en/test_variants_content.json create mode 100644 schemas/test/en/test_variants_first_item_in_list.json diff --git a/schemas/test/en/test_checkbox_detail_answer_dropdown.json b/schemas/test/en/test_checkbox_detail_answer_dropdown.json new file mode 100644 index 0000000000..01bdacb84c --- /dev/null +++ b/schemas/test/en/test_checkbox_detail_answer_dropdown.json @@ -0,0 +1,128 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Checkbox with Dropdown Detail Answer", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "checkbox", + "title": "Dropdown Checkbox with detail answer", + "blocks": [ + { + "type": "Question", + "id": "optional-checkbox-with-dropdown-detail-answer-block", + "question": { + "type": "General", + "id": "optional-checkbox-with-dropdown-detail-answer-question", + "title": "What is your favourite Ice Cream topping?", + "guidance": { + "contents": [ + { + "list": ["Fruit detail answer is optional", "Jam detail answer is mandatory"] + } + ] + }, + "answers": [ + { + "type": "Checkbox", + "id": "optional-checkbox-with-dropdown-detail-answer", + "instruction": "Select your favourite toppings", + "mandatory": false, + "options": [ + { + "label": "Sprinkles", + "value": "Sprinkles" + }, + { + "label": "Fruit", + "value": "Fruit", + "detail_answer": { + "type": "Dropdown", + "id": "optional-checkbox-with-optional-dropdown-detail-answer", + "mandatory": false, + "label": "Please specify type", + "placeholder": "Select fruit", + "options": [ + { + "label": "Mango", + "value": "Mango" + }, + { + "label": "Pineapple", + "value": "Pineapple" + }, + { + "label": "Peach", + "value": "Peach" + } + ] + } + }, + { + "label": "Jam", + "value": "Jam", + "detail_answer": { + "type": "Dropdown", + "id": "optional-checkbox-with-mandatory-dropdown-detail-answer", + "mandatory": true, + "label": "Please specify type", + "validation": { + "messages": { + "MANDATORY_DROPDOWN": "Please select the type of Jam" + } + }, + "options": [ + { + "label": "Strawberry", + "value": "Strawberry" + }, + { + "label": "Raspberry", + "value": "Raspberry" + }, + { + "label": "Apricot", + "value": "Apricot" + } + ] + } + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_checkbox_detail_answer_multiple.json b/schemas/test/en/test_checkbox_detail_answer_multiple.json new file mode 100644 index 0000000000..99d965bc8b --- /dev/null +++ b/schemas/test/en/test_checkbox_detail_answer_multiple.json @@ -0,0 +1,116 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Detail answer fields", + "theme": "default", + "description": "A questionnaire to demo checkbox field detail answer input.", + "messages": { + "NUMBER_TOO_LARGE": "Number is too large", + "NUMBER_TOO_SMALL": "Number cannot be less than zero", + "INVALID_NUMBER": "Please enter an integer" + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "mandatory-checkbox", + "question": { + "answers": [ + { + "id": "mandatory-checkbox-answer", + "mandatory": false, + "options": [ + { + "label": "None", + "value": "None" + }, + { + "label": "Cheese", + "value": "Cheese", + "detail_answer": { + "mandatory": false, + "id": "cheese-type-answer", + "label": "Type specific cheese if cheddar isn’t wanted", + "type": "TextField" + } + }, + { + "label": "Ham", + "value": "Ham" + }, + { + "label": "Pineapple", + "value": "Pineapple" + }, + { + "label": "Tuna", + "value": "Tuna" + }, + { + "label": "Pepperoni", + "value": "Pepperoni" + }, + { + "label": "Your choice", + "description": "Choose any other topping", + "value": "Your choice", + "detail_answer": { + "mandatory": true, + "id": "your-choice-answer-mandatory", + "label": "Please specify your topping", + "type": "TextField", + "validation": { + "messages": { + "MANDATORY_TEXTFIELD": "Enter your topping choice to continue" + } + } + } + } + ], + "type": "Checkbox", + "validation": { + "messages": {} + } + } + ], + "id": "mandatory-checkbox-question", + "title": "Which pizza toppings would you like?", + "type": "General" + } + } + ], + "id": "checkboxes" + } + ] + } + ] +} diff --git a/schemas/test/en/test_checkbox_detail_answer_numeric.json b/schemas/test/en/test_checkbox_detail_answer_numeric.json new file mode 100644 index 0000000000..1796bcf13f --- /dev/null +++ b/schemas/test/en/test_checkbox_detail_answer_numeric.json @@ -0,0 +1,96 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Other input fields", + "theme": "default", + "description": "A questionnaire to demo checkbox field detail answer input.", + "messages": { + "NUMBER_TOO_LARGE": "Number is too large", + "NUMBER_TOO_SMALL": "Number cannot be less than zero", + "INVALID_NUMBER": "Please enter an integer" + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "checkbox-numeric-detail", + "question": { + "answers": [ + { + "id": "checkbox-numeric-detail-answer", + "mandatory": true, + "options": [ + { + "label": "None", + "value": "None" + }, + { + "label": "1", + "value": "1" + }, + { + "label": "2", + "value": "2" + }, + { + "label": "Other", + "description": "Choose any number of toppings", + "value": "Other", + "detail_answer": { + "mandatory": false, + "id": "other-answer", + "label": "Please specify other", + "type": "Number", + "maximum": { + "value": 20 + } + } + } + ], + "type": "Checkbox", + "validation": { + "messages": {} + } + } + ], + "id": "checkbox-question-numeric-detail", + "title": "How many pizza toppings would you like?", + "type": "General" + } + } + ], + "id": "checkboxes" + } + ] + } + ] +} diff --git a/schemas/test/en/test_checkbox_detail_answer_textfield.json b/schemas/test/en/test_checkbox_detail_answer_textfield.json new file mode 100644 index 0000000000..64f604939e --- /dev/null +++ b/schemas/test/en/test_checkbox_detail_answer_textfield.json @@ -0,0 +1,198 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Checkbox details answer visibility", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section-1", + "groups": [ + { + "id": "checkbox", + "title": "Checkbox Open", + "blocks": [ + { + "type": "Question", + "id": "checkbox-visible-true", + "question": { + "type": "General", + "id": "checkbox-visible-true-question", + "title": "What is your favourite drink?", + "answers": [ + { + "type": "Checkbox", + "id": "checkbox-visible-true-answer", + "mandatory": false, + "options": [ + { + "label": "Coffee", + "value": "Coffee" + }, + { + "detail_answer": { + "id": "checkbox-visible-true-answer-other", + "label": "Enter your favourite drink", + "mandatory": false, + "visible": true, + "type": "TextField" + }, + "label": "Other", + "value": "Other" + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "checkbox-visible-false", + "question": { + "type": "General", + "id": "checkbox-visible-false-question", + "title": "What is your favourite food?", + "answers": [ + { + "type": "Checkbox", + "id": "checkbox-visible-false-answer", + "mandatory": false, + "options": [ + { + "label": "Ice cream", + "value": "Ice cream" + }, + { + "description": "Select to enter answer", + "detail_answer": { + "id": "checkbox-visible-false-answer-other", + "label": "Enter your favourite food", + "mandatory": false, + "visible": false, + "type": "TextField" + }, + "label": "Other", + "value": "Other" + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "checkbox-visible-none", + "question": { + "type": "General", + "id": "checkbox-visible-none-question", + "title": "What is your favourite colour?", + "answers": [ + { + "type": "Checkbox", + "id": "checkbox-visible-none-answer", + "mandatory": false, + "options": [ + { + "label": "Blue", + "value": "Blue" + }, + { + "description": "Select to enter answer", + "detail_answer": { + "id": "checkbox-visible-none-answer-other", + "label": "Enter your favourite colour", + "mandatory": false, + "type": "TextField" + }, + "label": "Other", + "value": "Other" + } + ] + } + ] + } + }, + { + "id": "mutually-exclusive", + "question": { + "answers": [ + { + "id": "mutually-exclusive-answer", + "mandatory": false, + "options": [ + { + "label": "Football", + "value": "Football" + }, + { + "label": "Rugby", + "value": "Rugby" + }, + { + "label": "Cricket", + "value": "Cricket" + }, + { + "detail_answer": { + "id": "mutually-exclusive-answer-other", + "label": "Please specify your favourite sport", + "mandatory": false, + "max_length": 100, + "type": "TextField", + "visible": true + }, + "label": "Other", + "value": "Other" + } + ], + "type": "Checkbox" + }, + { + "id": "mutually-exclusive-answer-exclusive", + "mandatory": false, + "options": [ + { + "label": "None", + "value": "None" + } + ], + "type": "Checkbox" + } + ], + "id": "mutually-exclusive-question", + "mandatory": false, + "title": "What is your favourite sport?", + "type": "MutuallyExclusive" + }, + "type": "Question" + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_checkbox_instruction.json b/schemas/test/en/test_checkbox_instruction.json new file mode 100644 index 0000000000..715ce4d12b --- /dev/null +++ b/schemas/test/en/test_checkbox_instruction.json @@ -0,0 +1,168 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test checkbox answer instruction", + "theme": "default", + "description": "A questionnaire to test checkbox answer instruction.", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "default-instruction-checkbox", + "question": { + "answers": [ + { + "id": "default-instruction-checkbox-answer", + "mandatory": false, + "options": [ + { + "label": "Red", + "value": "Red" + }, + { + "label": "Blue", + "value": "Blue" + }, + { + "label": "Green", + "value": "Green" + } + ], + "type": "Checkbox" + } + ], + "id": "default-instruction-checkbox-question", + "title": "What is your favourite colour?", + "type": "General" + } + }, + { + "type": "Question", + "id": "no-instruction-checkbox", + "question": { + "answers": [ + { + "id": "no-instruction-checkbox-answer", + "mandatory": false, + "instruction": null, + "options": [ + { + "label": "Rugby", + "value": "Rugby" + }, + { + "label": "Golf", + "value": "Golf" + }, + { + "label": "Tennis", + "value": "Tennis" + } + ], + "type": "Checkbox" + } + ], + "id": "no-instruction-checkbox-question", + "title": "What is your favourite sport?", + "type": "General" + } + }, + { + "type": "Question", + "id": "custom-instruction-checkbox", + "question": { + "answers": [ + { + "id": "custom-instruction-checkbox-answer", + "mandatory": false, + "instruction": "Select your answer", + "options": [ + { + "label": "Monday", + "value": "Monday" + }, + { + "label": "Saturday", + "value": "Saturday" + }, + { + "label": "Sunday", + "value": "Sunday" + } + ], + "type": "Checkbox" + } + ], + "id": "custom-instruction-checkbox-question", + "title": "What is your favorite day of the week?", + "type": "General" + } + }, + { + "type": "Question", + "id": "instruction-and-label-checkbox", + "question": { + "answers": [ + { + "id": "instruction-and-label-checkbox-answer", + "mandatory": false, + "instruction": "Select your answer", + "label": "Days of the Week", + "options": [ + { + "label": "Monday", + "value": "Monday" + }, + { + "label": "Saturday", + "value": "Saturday" + }, + { + "label": "Sunday", + "value": "Sunday" + } + ], + "type": "Checkbox" + } + ], + "id": "instruction-and-label-question", + "title": "What is your favorite day of the week?", + "type": "General" + } + } + ], + "id": "checkboxes" + } + ] + } + ] +} diff --git a/schemas/test/en/test_conditional_combined_routing.json b/schemas/test/en/test_conditional_combined_routing.json new file mode 100644 index 0000000000..a8a2935baa --- /dev/null +++ b/schemas/test/en/test_conditional_combined_routing.json @@ -0,0 +1,147 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "023", + "title": "Test Conditional Routing", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "single-answer-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "conditional-routing-block", + "question": { + "id": "conditional-routing-question", + "title": "Do you drink coffee?", + "type": "General", + "answers": [ + { + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "Sometimes", + "value": "Sometimes" + }, + { + "label": "No, I prefer tea", + "value": "No, I prefer tea" + }, + { + "label": "I don’t like coffee", + "value": "I don’t like coffee" + }, + { + "label": "No, I don’t drink any hot drinks", + "value": "No, I don’t drink any hot drinks" + } + ], + "id": "conditional-routing-answer", + "label": "Which conditional question should we jump to?", + "mandatory": true, + "type": "Radio" + } + ] + }, + "routing_rules": [ + { + "block": "response-any", + "when": { + "in": [ + { + "identifier": "conditional-routing-answer", + "source": "answers" + }, + ["Yes", "Sometimes"] + ] + } + }, + { + "block": "response-not-any", + "when": { + "not": [ + { + "in": [ + { "identifier": "conditional-routing-answer", "source": "answers" }, + ["Yes", "Sometimes", "I don’t like coffee", "No, I don’t drink any hot drinks"] + ] + } + ] + } + }, + { + "section": "End" + } + ] + }, + { + "type": "Question", + "id": "response-any", + "question": { + "id": "response-any-question", + "title": "How many cups of coffee do you drink a day?", + "type": "General", + "answers": [ + { + "id": "response-any-number-of-cups", + "label": "Number of cups", + "mandatory": true, + "type": "Number" + } + ] + } + }, + { + "type": "Question", + "id": "response-not-any", + "question": { + "id": "response-not-any-question", + "title": "How many cups of tea do you drink a day?", + "type": "General", + "answers": [ + { + "id": "response-not-any-number-of-cups", + "label": "Number of cups", + "mandatory": true, + "type": "Number" + } + ] + } + } + ], + "id": "conditional-routing-within-group", + "title": "Conditional routing within group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_confirmation_email.json b/schemas/test/en/test_confirmation_email.json new file mode 100644 index 0000000000..835b153691 --- /dev/null +++ b/schemas/test/en/test_confirmation_email.json @@ -0,0 +1,75 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "form_type": "H", + "region_code": "GB-WLS", + "title": "Confirmation email test schema", + "theme": "default", + "description": "A questionnaire to test confirmation email", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "post_submission": { + "confirmation_email": true + }, + "sections": [ + { + "id": "schema-confirmation-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "schema-confirmation", + "question": { + "answers": [ + { + "type": "Radio", + "id": "schema-confirmation-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ], + "id": "schema-question", + "title": "Are you aware you can send a confirmation email for this schema?", + "type": "General" + } + } + ], + "id": "schema-confirmation-group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_confirmation_question.json b/schemas/test/en/test_confirmation_question.json new file mode 100644 index 0000000000..1f526d4182 --- /dev/null +++ b/schemas/test/en/test_confirmation_question.json @@ -0,0 +1,220 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "survey_id": "139", + "theme": "default", + "title": "Confirmation Question Test", + "data_version": "0.0.3", + "description": "Confirmation Question Test", + "navigation": { + "visible": true + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "trad_as", + "type": "string", + "optional": true + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "title": "Questions", + "groups": [ + { + "id": "confirmation-block", + "title": "Confirmation Question Test", + "blocks": [ + { + "id": "number-of-employees-total-block", + "question": { + "answers": [ + { + "id": "number-of-employees-total", + "label": "Total number of employees", + "mandatory": false, + "type": "Number", + "default": 0 + } + ], + "id": "number-of-employees-total-question", + "title": { + "text": "How many employees work at {company_name}?", + "placeholders": [ + { + "placeholder": "company_name", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "metadata", + "identifier": "trad_as" + }, + { + "source": "metadata", + "identifier": "ru_name" + } + ] + } + } + ] + } + ] + }, + "type": "General" + }, + "type": "Question" + }, + { + "type": "ConfirmationQuestion", + "id": "confirm-zero-employees-block", + "skip_conditions": { + "when": { + ">": [ + { + "source": "answers", + "identifier": "number-of-employees-total" + }, + 0 + ] + } + }, + "question": { + "type": "General", + "answers": [ + { + "type": "Radio", + "id": "confirm-zero-employees-answer", + "options": [ + { + "label": "Yes this is correct", + "value": "Yes this is correct" + }, + { + "label": "No I need to correct this", + "value": "No I need to correct this" + } + ], + "mandatory": true + } + ], + "id": "confirm-zero-employees-question", + "title": { + "text": "The current number of employees for {company_name} is 0, is this correct?", + "placeholders": [ + { + "placeholder": "company_name", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "metadata", + "identifier": "trad_as" + }, + { + "source": "metadata", + "identifier": "ru_name" + } + ] + } + } + ] + } + ] + } + }, + "routing_rules": [ + { + "when": { + "==": [ + { + "identifier": "confirm-zero-employees-answer", + "source": "answers" + }, + "No I need to correct this" + ] + }, + "block": "number-of-employees-total-block" + }, + { + "section": "End" + } + ] + }, + { + "id": "number-of-employees-split-block", + "type": "Question", + "question": { + "answers": [ + { + "id": "number-of-employees-male-more-30-hours", + "label": "Number of male employees working more than 30 hours per week", + "mandatory": false, + "type": "Number", + "maximum": { + "value": { + "source": "answers", + "identifier": "number-of-employees-total" + } + } + }, + { + "id": "number-of-employees-female-more-30-hours", + "label": "Number of female employees working more than 30 hours per week", + "mandatory": false, + "type": "Number", + "maximum": { + "value": { + "source": "answers", + "identifier": "number-of-employees-total" + } + } + } + ], + "id": "number-of-employees-split-question", + "title": { + "text": "Of the {number_of_employees_total} total employees employed, how many male and female employees worked the following hours?", + "placeholders": [ + { + "placeholder": "number_of_employees_total", + "value": { + "source": "answers", + "identifier": "number-of-employees-total" + } + } + ] + }, + "type": "General" + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_confirmation_question_backwards_routing.json b/schemas/test/en/test_confirmation_question_backwards_routing.json new file mode 100644 index 0000000000..b8bc14b8fe --- /dev/null +++ b/schemas/test/en/test_confirmation_question_backwards_routing.json @@ -0,0 +1,190 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "survey_id": "139", + "theme": "default", + "title": "New Confirmation Question Test", + "data_version": "0.0.3", + "description": "New Confirmation Question Test", + "navigation": { + "visible": true + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "trad_as", + "type": "string", + "optional": true + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "title": "Section 1", + "groups": [ + { + "id": "confirmation", + "title": "Confirmation Driver", + "blocks": [ + { + "type": "Question", + "id": "route-backwards-block", + "question": { + "type": "General", + "id": "route-backwards-question", + "title": "Do you want the confirmation question to route backwards, so the answer can be changed?", + "answers": [ + { + "type": "Radio", + "id": "route-backwards-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "section-2", + "title": "Section 2", + "groups": [ + { + "id": "group-2", + "title": "Confirmation Question", + "blocks": [ + { + "id": "number-of-employees-total-block", + "question": { + "answers": [ + { + "id": "number-of-employees-total", + "label": "Total number of employees", + "mandatory": false, + "type": "Number", + "default": 0 + } + ], + "id": "number-of-employees-total-question", + "title": { + "text": "How many employees work at {company_name}?", + "placeholders": [ + { + "placeholder": "company_name", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "metadata", + "identifier": "trad_as" + }, + { + "source": "metadata", + "identifier": "ru_name" + } + ] + } + } + ] + } + ] + }, + "type": "General" + }, + "type": "Question" + }, + { + "type": "ConfirmationQuestion", + "id": "confirm-zero-employees-block", + "question": { + "type": "General", + "answers": [ + { + "type": "Radio", + "id": "confirm-zero-employees-answer", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No I need to correct this", + "value": "No I need to correct this" + } + ], + "mandatory": true + } + ], + "id": "confirm-zero-employees-question", + "title": "Did you answer the last question correctly?" + }, + "routing_rules": [ + { + "block": "number-of-employees-total-block", + "when": { + "and": [ + { + "==": [ + { + "source": "answers", + "identifier": "confirm-zero-employees-answer" + }, + "No I need to correct this" + ] + }, + { + "==": [ + { + "source": "answers", + "identifier": "route-backwards-answer" + }, + "Yes" + ] + } + ] + } + }, + { + "section": "End" + } + ] + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_confirmation_question_within_repeating_section.json b/schemas/test/en/test_confirmation_question_within_repeating_section.json new file mode 100644 index 0000000000..6f754192de --- /dev/null +++ b/schemas/test/en/test_confirmation_question_within_repeating_section.json @@ -0,0 +1,491 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "survey_id": "139", + "theme": "default", + "title": "Confirmation Question Test", + "data_version": "0.0.3", + "description": "Confirmation Question Test", + "navigation": { + "visible": true + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "trad_as", + "type": "string", + "optional": true + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "default-section", + "title": "Questions", + "summary": { + "show_on_completion": true + }, + "repeat": { + "for_list": "people", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "groups": [ + { + "id": "dob-group", + "title": "Date of birth", + "blocks": [ + { + "type": "Question", + "id": "dob-block", + "question": { + "answers": [ + { + "id": "date-of-birth-answer", + "mandatory": true, + "maximum": { + "value": "now" + }, + "minimum": { + "offset_by": { + "years": -115 + }, + "value": "2019-10-13" + }, + "type": "Date" + } + ], + "guidance": { + "contents": [ + { + "description": "For example 31 12 1970" + } + ] + }, + "id": "date-of-birth-question", + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "What is {person_name_possessive} date of birth?" + }, + "type": "General" + } + }, + { + "type": "ConfirmationQuestion", + "id": "confirm-dob-block", + "skip_conditions": { + "when": { + "<=": [ + { + "date": [ + { + "source": "answers", + "identifier": "date-of-birth-answer" + } + ] + }, + { "date": ["now", { "years": -16 }] } + ] + } + }, + "question": { + "answers": [ + { + "id": "confirm-date-of-birth-answer", + "mandatory": true, + "options": [ + { + "label": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + }, + { + "placeholder": "age", + "transforms": [ + { + "arguments": { + "first_date": { + "identifier": "date-of-birth-answer", + "source": "answers" + }, + "second_date": { + "value": "now" + } + }, + "transform": "calculate_date_difference" + } + ] + } + ], + "text": "Yes, {person_name} is {age} old" + }, + "value": "Yes, {person_name} is {age} old" + }, + { + "label": "No, I need to change their date of birth", + "value": "No, I need to change their date of birth" + } + ], + "type": "Radio" + } + ], + "id": "confirm-date-of-birth", + "title": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + }, + { + "placeholder": "age", + "transforms": [ + { + "arguments": { + "first_date": { + "identifier": "date-of-birth-answer", + "source": "answers" + }, + "second_date": { + "value": "now" + } + }, + "transform": "calculate_date_difference" + } + ] + } + ], + "text": "{person_name} is {age} old. Is this correct?" + }, + "type": "General" + }, + "routing_rules": [ + { + "block": "dob-block", + "when": { + "==": [ + { + "source": "answers", + "identifier": "confirm-date-of-birth-answer" + }, + "No, I need to change their date of birth" + ] + } + }, + { + "section": "End" + } + ] + }, + { + "id": "carer-block", + "question": { + "id": "carer-question", + "type": "General", + "title": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ], + "text": "Does {person_name} look after, or give any help or support to, anyone because they have long-term physical or mental health conditions or illnesses, or problems related to old age?" + }, + "answers": [ + { + "id": "carer-answer", + "label": "Carer", + "mandatory": false, + "type": "Radio", + "default": "Yes", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "type": "Question" + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_currency.json b/schemas/test/en/test_currency.json new file mode 100644 index 0000000000..9f26654f51 --- /dev/null +++ b/schemas/test/en/test_currency.json @@ -0,0 +1,190 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Other input fields", + "theme": "default", + "description": "A questionnaire to test currency input type", + "messages": { + "INVALID_DECIMAL": "Please enter a number to %(max)d decimal places" + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string", + "optional": true + }, + { + "name": "trad_as", + "type": "string", + "optional": true + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "block", + "question": { + "answers": [ + { + "id": "answer-gbp", + "label": "How much did you spend?", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "maximum": { + "value": 10000 + } + }, + { + "id": "answer-usd", + "label": "How much did you spend?", + "mandatory": false, + "type": "Currency", + "currency": "USD", + "decimal_places": 2, + "maximum": { + "value": 10000 + } + }, + { + "id": "answer-eur", + "label": "How much did you spend?", + "mandatory": false, + "type": "Currency", + "currency": "EUR", + "decimal_places": 2, + "maximum": { + "value": 10000 + } + }, + { + "id": "answer-jpy", + "label": "How much did you spend?", + "mandatory": false, + "type": "Currency", + "currency": "JPY", + "maximum": { + "value": 1000000 + } + }, + { + "id": "answer-gbp-max-range", + "label": "How much did you spend? (Max range)", + "mandatory": false, + "type": "Currency", + "currency": "GBP" + } + ], + "id": "currency-question", + "title": "Currency Input Test Positve", + "type": "General" + } + }, + { + "type": "Question", + "id": "negative-block", + "question": { + "answers": [ + { + "id": "negative-answer-gbp", + "label": "How much did you spend?", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "maximum": { + "value": 10000 + }, + "minimum": { + "value": -1000000 + } + }, + { + "id": "negative-answer-usd", + "label": "How much did you spend?", + "mandatory": false, + "type": "Currency", + "currency": "USD", + "decimal_places": 2, + "maximum": { + "value": 10000 + }, + "minimum": { + "value": -1000000 + } + }, + { + "id": "negative-answer-eur", + "label": "How much did you spend?", + "mandatory": false, + "type": "Currency", + "currency": "EUR", + "decimal_places": 2, + "maximum": { + "value": 10000 + }, + "minimum": { + "value": -1000000 + } + }, + { + "id": "negative-answer-jpy", + "label": "How much did you spend?", + "mandatory": false, + "type": "Currency", + "currency": "JPY", + "maximum": { + "value": 1000000 + }, + "minimum": { + "value": -1000000 + } + }, + { + "id": "answer-gbp-min-range", + "label": "How much did you spend? (Min range)", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "minimum": { + "value": -99999999999999 + } + } + ], + "id": "negative-currency-question", + "title": "Currency Input Test Including Negative Values", + "type": "General" + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_custom_page_titles.json b/schemas/test/en/test_custom_page_titles.json new file mode 100644 index 0000000000..1b9865a4a4 --- /dev/null +++ b/schemas/test/en/test_custom_page_titles.json @@ -0,0 +1,1096 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Custom Page Titles", + "theme": "default", + "description": "A questionnaire to test custom page titles.", + "messages": {}, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section", + "title": "Household", + "summary": { + "show_on_completion": true, + "page_title": "Custom section summary page title", + "items": [ + { + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders", + "for_list": "household", + "title": "Household members", + "type": "List" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "Relationships", + "blocks": [ + { + "id": "list-collector", + "type": "ListCollector", + "page_title": "Custom page title", + "for_list": "household", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live at 1 Pleasant Lane?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "page_title": "Add person {list_item_position}", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "page_title": "Edit person {list_item_position}", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "page_title": "Remove person {list_item_position}", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "People who live here", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "type": "RelationshipCollector", + "id": "relationships", + "title": "This will iterate over the household list, capturing the one way relationships.", + "page_title": "How Person {list_item_position} is related to Person {to_list_item_position}", + "for_list": "household", + "question": { + "id": "relationship-question", + "type": "General", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their ", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "answers": [ + { + "id": "relationship-answer", + "mandatory": true, + "type": "Relationship", + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} ", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "options": [ + { + "label": "Husband or Wife", + "value": "Husband or Wife", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their husband or wife", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} husband or wife", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + { + "label": "Legally registered civil partner", + "value": "Legally registered civil partner", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their legally registered civil partner", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} legally registered civil partner", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + { + "label": "Son or daughter", + "value": "Son or daughter", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their son or daughter", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} son or daughter", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + { + "label": "Brother or sister", + "value": "Brother or sister", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their brother or sister", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} brother or sister", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "description": "Including half brother or half sister" + } + ] + } + ] + }, + "skip_conditions": { + "when": { + "<": [ + { + "source": "list", + "identifier": "household", + "selector": "count" + }, + 2 + ] + } + } + } + ] + } + ] + }, + { + "title": "Individual Section", + "summary": { + "show_on_completion": true, + "page_title": "Summary" + }, + "groups": [ + { + "blocks": [ + { + "content": { + "contents": [ + { + "description": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ], + "text": "In this section, we are going to ask you questions about {person_name}." + } + }, + { + "list": ["date of birth"], + "title": "You will need to know personal details such as" + } + ], + "title": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ], + "text": "{person_name}" + } + }, + "page_title": "Individual interstitial", + "id": "individual-interstitial", + "type": "Interstitial" + }, + { + "id": "proxy", + "page_title": "Proxy question", + "question": { + "answers": [ + { + "default": "No, I am answering on their behalf", + "id": "proxy-answer", + "mandatory": false, + "options": [ + { + "label": "Yes, I am", + "value": "Yes, I am" + }, + { + "label": "No, I am answering on their behalf", + "value": "No, I am answering on their behalf" + } + ], + "type": "Radio" + } + ], + "id": "proxy-question", + "title": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ], + "text": "Are you {person_name}?" + }, + "type": "General" + }, + "type": "Question" + }, + { + "type": "Question", + "id": "date-of-birth", + "question": { + "id": "date-pipe-question", + "title": "What is your date of birth?", + "type": "General", + "answers": [ + { + "id": "date-dob", + "label": "For example 20 March 1990", + "mandatory": false, + "type": "Date" + } + ] + } + } + ], + "id": "personal-details-group", + "title": "Personal Details" + } + ], + "id": "individual-section", + "repeat": { + "for_list": "household", + "title": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ], + "text": "{person_name}" + }, + "page_title": "Person {list_item_position}" + } + } + ] +} diff --git a/schemas/test/en/test_custom_question_summary.json b/schemas/test/en/test_custom_question_summary.json new file mode 100644 index 0000000000..e89de05eab --- /dev/null +++ b/schemas/test/en/test_custom_question_summary.json @@ -0,0 +1,153 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Custom question summary", + "theme": "default", + "description": "A questionnaire to demo custom question summaries", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "title": "test", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "name", + "question": { + "id": "name-question", + "title": "Name", + "type": "General", + "summary": { + "concatenation_type": "Space" + }, + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": false, + "type": "TextField" + }, + { + "id": "middle-name", + "label": "Middle name", + "mandatory": false, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": false, + "type": "TextField" + } + ] + } + }, + { + "type": "Question", + "id": "address", + "question": { + "id": "address-question", + "title": "Address details", + "type": "General", + "summary": { + "concatenation_type": "Newline" + }, + "answers": [ + { + "id": "address-line1", + "label": "Address Line 1", + "mandatory": false, + "type": "TextField" + }, + { + "id": "address-line2", + "label": "Address Line 2", + "mandatory": false, + "type": "TextField" + }, + { + "id": "town-city", + "label": "Town/City", + "mandatory": false, + "type": "TextField" + }, + { + "id": "county", + "label": "County", + "mandatory": false, + "type": "TextField" + }, + { + "id": "postcode", + "label": "Postcode", + "mandatory": false, + "type": "TextField" + } + ] + } + }, + { + "type": "Question", + "id": "age", + "question": { + "id": "age-question", + "title": "Age", + "type": "General", + "summary": { + "concatenation_type": "Newline" + }, + "answers": [ + { + "id": "age-number", + "label": "Enter your age", + "mandatory": false, + "type": "Number" + }, + { + "id": "single-checkbox-answer", + "mandatory": false, + "instruction": "Confirmation", + "options": [ + { + "label": "This age is an estimate", + "value": "This age is an estimate" + } + ], + "type": "Checkbox" + } + ] + } + } + ], + "id": "default-group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_date_range.json b/schemas/test/en/test_date_range.json new file mode 100644 index 0000000000..ccfe1d9214 --- /dev/null +++ b/schemas/test/en/test_date_range.json @@ -0,0 +1,68 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "023", + "title": "Date range", + "description": "A test schema for different date formats", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "date-block", + "question": { + "answers": [ + { + "id": "date-range-from-answer", + "label": "Period from", + "mandatory": true, + "type": "Date" + }, + { + "id": "date-range-to-answer", + "label": "Period to", + "mandatory": true, + "type": "Date" + } + ], + "id": "date-range-question", + "title": "Date range", + "warning": "The period to date must be after the period from date", + "type": "DateRange" + } + } + ], + "id": "dates" + } + ] + } + ] +} diff --git a/schemas/test/en/test_date_validation_combined.json b/schemas/test/en/test_date_validation_combined.json new file mode 100644 index 0000000000..09d6ed7eb6 --- /dev/null +++ b/schemas/test/en/test_date_validation_combined.json @@ -0,0 +1,153 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "023", + "title": "Date formats", + "description": "A test schema for different date formats", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "ref_p_start_date", + "type": "date" + }, + { + "name": "ref_p_end_date", + "type": "date" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "dates", + "title": "Date Range Validation", + "blocks": [ + { + "type": "Question", + "id": "date-range-block", + "question": { + "id": "date-range-question", + "title": "Enter Date Range", + "type": "DateRange", + "guidance": { + "contents": [ + { + "description": "Dates between 10 and 50 days apart" + }, + { + "description": { + "text": "Period from date greater than 19 days before {date}", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + } + }, + { + "description": { + "text": "Period to date no greater than 20 days after {date}", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_end_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + } + } + ] + }, + "period_limits": { + "minimum": { + "days": 10 + }, + "maximum": { + "days": 50 + } + }, + "answers": [ + { + "id": "date-range-from", + "label": "Period from", + "mandatory": true, + "type": "Date", + "minimum": { + "value": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "offset_by": { + "days": -19 + } + } + }, + { + "id": "date-range-to", + "label": "Period to", + "mandatory": true, + "type": "Date", + "maximum": { + "value": { + "source": "metadata", + "identifier": "ref_p_end_date" + }, + "offset_by": { + "days": 20 + } + } + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_date_validation_mm_yyyy_combined.json b/schemas/test/en/test_date_validation_mm_yyyy_combined.json new file mode 100644 index 0000000000..4360d30ffa --- /dev/null +++ b/schemas/test/en/test_date_validation_mm_yyyy_combined.json @@ -0,0 +1,153 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "023", + "title": "Date formats", + "description": "A test schema for different date formats", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "ref_p_start_date", + "type": "date" + }, + { + "name": "ref_p_end_date", + "type": "date" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "dates", + "title": "Date Range Validation", + "blocks": [ + { + "type": "Question", + "id": "date-range-block", + "question": { + "id": "date-range-question", + "title": "Enter Date Range", + "type": "DateRange", + "guidance": { + "contents": [ + { + "description": "Dates between 2 and 3 months apart" + }, + { + "description": { + "text": "Period from date greater than 1 month before {date}", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + } + }, + { + "description": { + "text": "Period to date no greater than 3 months after {date}", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_end_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + } + } + ] + }, + "period_limits": { + "minimum": { + "months": 2 + }, + "maximum": { + "months": 3 + } + }, + "answers": [ + { + "id": "date-range-from", + "label": "Period from", + "mandatory": true, + "type": "MonthYearDate", + "minimum": { + "value": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "offset_by": { + "months": -1 + } + } + }, + { + "id": "date-range-to", + "label": "Period to", + "mandatory": true, + "type": "MonthYearDate", + "maximum": { + "value": { + "source": "metadata", + "identifier": "ref_p_end_date" + }, + "offset_by": { + "months": 3 + } + } + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_date_validation_range.json b/schemas/test/en/test_date_validation_range.json new file mode 100644 index 0000000000..97658510fe --- /dev/null +++ b/schemas/test/en/test_date_validation_range.json @@ -0,0 +1,84 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "023", + "title": "Date formats", + "description": "A test schema for different date formats", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "dates", + "title": "Date Range Validation", + "blocks": [ + { + "type": "Question", + "id": "date-range-block", + "question": { + "id": "date-range-question", + "title": "Enter Date Range", + "type": "DateRange", + "guidance": { + "contents": [ + { + "description": "Enter a date range between 23 days and 1 month and 20 days apart" + } + ] + }, + "period_limits": { + "minimum": { + "days": 23 + }, + "maximum": { + "months": 1, + "days": 20 + } + }, + "answers": [ + { + "id": "date-range-from", + "label": "Period from", + "mandatory": true, + "type": "Date" + }, + { + "id": "date-range-to", + "label": "Period to", + "mandatory": true, + "type": "Date" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_date_validation_single.json b/schemas/test/en/test_date_validation_single.json new file mode 100644 index 0000000000..eeeabeb5a5 --- /dev/null +++ b/schemas/test/en/test_date_validation_single.json @@ -0,0 +1,165 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "023", + "title": "Date formats", + "description": "A test schema for single date period validation", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "ref_p_start_date", + "type": "date" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "dates", + "title": "Date Range Validation", + "blocks": [ + { + "type": "Question", + "id": "date-block", + "question": { + "id": "date-question", + "title": "Enter Date", + "type": "General", + "answers": [ + { + "id": "date", + "label": "Enter date", + "mandatory": true, + "type": "Date" + } + ] + } + }, + { + "type": "Question", + "id": "date-range-block", + "question": { + "id": "date-range-question", + "title": "Enter Date Range", + "type": "DateRange", + "guidance": { + "contents": [ + { + "description": { + "text": "Period ‘from’ date should be greater than 19 days before {date}", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + } + }, + { + "description": "Period ‘from’ should also be no greater than 20 days after 11 June 2017" + }, + { + "description": { + "text": "Period ‘to’ date should be greater than 1 month 10 days after {date}", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "answers", + "identifier": "date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + } + } + ] + }, + "answers": [ + { + "id": "date-range-from", + "label": "Period from", + "mandatory": true, + "type": "Date", + "minimum": { + "value": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "offset_by": { + "days": -19 + } + }, + "maximum": { + "value": "2017-06-11", + "offset_by": { + "days": 20 + } + } + }, + { + "id": "date-range-to", + "label": "Period to", + "mandatory": true, + "type": "Date", + "minimum": { + "value": { + "source": "answers", + "identifier": "date" + }, + "offset_by": { + "months": 1, + "days": 10 + } + } + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_date_validation_yyyy_combined.json b/schemas/test/en/test_date_validation_yyyy_combined.json new file mode 100644 index 0000000000..a0387efa52 --- /dev/null +++ b/schemas/test/en/test_date_validation_yyyy_combined.json @@ -0,0 +1,153 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "023", + "title": "Date formats", + "description": "A test schema for different date formats", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "ref_p_start_date", + "type": "date" + }, + { + "name": "ref_p_end_date", + "type": "date" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "dates", + "title": "Date Range Validation", + "blocks": [ + { + "type": "Question", + "id": "date-range-block", + "question": { + "id": "date-range-question", + "title": "Enter Date Range", + "type": "DateRange", + "guidance": { + "contents": [ + { + "description": "Dates between 2 and 3 years apart" + }, + { + "description": { + "text": "Period from date greater than 1 year before {date}", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + } + }, + { + "description": { + "text": "Period to date no greater than 3 years after {date}", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_end_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + } + } + ] + }, + "period_limits": { + "minimum": { + "years": 2 + }, + "maximum": { + "years": 3 + } + }, + "answers": [ + { + "id": "date-range-from", + "label": "Period from", + "mandatory": true, + "type": "YearDate", + "minimum": { + "value": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "offset_by": { + "years": -1 + } + } + }, + { + "id": "date-range-to", + "label": "Period to", + "mandatory": true, + "type": "YearDate", + "maximum": { + "value": { + "source": "metadata", + "identifier": "ref_p_end_date" + }, + "offset_by": { + "years": 3 + } + } + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_dates.json b/schemas/test/en/test_dates.json new file mode 100644 index 0000000000..90eadcffdf --- /dev/null +++ b/schemas/test/en/test_dates.json @@ -0,0 +1,135 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "023", + "title": "Date formats", + "description": "A test schema for different date formats", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "title": "Date Examples", + "groups": [ + { + "id": "dates", + "blocks": [ + { + "type": "Question", + "id": "date-range-block", + "question": { + "answers": [ + { + "id": "date-range-from-answer", + "label": "Period from", + "mandatory": true, + "type": "Date" + }, + { + "id": "date-range-to-answer", + "label": "Period to", + "mandatory": true, + "type": "Date" + } + ], + "id": "date-range-question", + "title": "Date range", + "type": "DateRange" + } + }, + { + "type": "Question", + "id": "date-month-year-block", + "question": { + "answers": [ + { + "id": "month-year-answer", + "mandatory": true, + "type": "MonthYearDate" + } + ], + "id": "month-year-question", + "title": "Date with month and year", + "type": "General" + } + }, + { + "type": "Question", + "id": "date-single-block", + "question": { + "answers": [ + { + "id": "single-date-answer", + "label": "Date", + "mandatory": true, + "type": "Date" + } + ], + "id": "single-date-question", + "title": "Single date type", + "type": "General" + } + }, + { + "type": "Question", + "id": "date-non-mandatory-block", + "question": { + "answers": [ + { + "id": "non-mandatory-date-answer", + "label": "Date", + "mandatory": false, + "type": "Date" + } + ], + "id": "non-mandatory-date-question", + "title": "Non Mandatory", + "type": "General" + } + }, + { + "type": "Question", + "id": "date-year-date-block", + "question": { + "answers": [ + { + "id": "year-date-answer", + "label": "Date", + "mandatory": false, + "type": "YearDate" + } + ], + "id": "year-date-question", + "title": "Year (YYYY)", + "type": "General" + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_default.json b/schemas/test/en/test_default.json new file mode 100644 index 0000000000..f7798f9ef1 --- /dev/null +++ b/schemas/test/en/test_default.json @@ -0,0 +1,79 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Number Equals", + "theme": "default", + "description": "A test survey for routing based on an number equals", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "number-question-one", + "question": { + "answers": [ + { + "id": "answer-one", + "mandatory": false, + "type": "Number", + "label": "Leave blank", + "default": 0 + } + ], + "id": "question", + "title": "Don’t enter an answer. A default value will be used", + "type": "General" + } + }, + { + "type": "Question", + "id": "number-question-two", + "question": { + "answers": [ + { + "id": "answer-two", + "mandatory": false, + "type": "Number", + "label": "Enter a Value" + } + ], + "id": "question2", + "title": "Enter an answer. It will be shown on the summary page", + "type": "General" + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_default_with_skip.json b/schemas/test/en/test_default_with_skip.json new file mode 100644 index 0000000000..08963ca5bf --- /dev/null +++ b/schemas/test/en/test_default_with_skip.json @@ -0,0 +1,119 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Number Equals", + "theme": "default", + "description": "A test survey for routing based on an number equals", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "number-question-one", + "question": { + "answers": [ + { + "id": "answer-one", + "mandatory": false, + "type": "Number", + "label": "Leave blank", + "default": 0 + } + ], + "id": "question", + "title": "Question One", + "type": "General" + } + }, + { + "type": "Question", + "id": "number-question-two", + "question": { + "answers": [ + { + "id": "answer-two", + "mandatory": false, + "type": "Number", + "label": "Enter a Value", + "default": 1 + } + ], + "id": "question2", + "title": "Question Two", + "type": "General" + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "answers", + "identifier": "answer-one" + }, + 1 + ] + } + } + }, + { + "type": "Question", + "id": "number-question-three", + "question": { + "answers": [ + { + "id": "answer-three", + "mandatory": false, + "type": "Number", + "label": "Leave blank" + } + ], + "id": "question3", + "title": "Question Three", + "type": "General" + }, + "skip_conditions": { + "when": { + "==": [ + { + "source": "answers", + "identifier": "answer-two" + }, + 1 + ] + } + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_dob_date.json b/schemas/test/en/test_dob_date.json new file mode 100644 index 0000000000..70581d7670 --- /dev/null +++ b/schemas/test/en/test_dob_date.json @@ -0,0 +1,213 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "999", + "title": "Test Date and DOB routing", + "description": "Tests ", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "date-of-birth", + "question": { + "id": "date-of-birth-question", + "title": "What is your date of birth?", + "type": "General", + "answers": [ + { + "id": "date-of-birth-answer", + "mandatory": false, + "type": "Date", + "maximum": { + "value": "now" + }, + "minimum": { + "value": "1900-01-01" + } + } + ] + }, + "routing_rules": [ + { + "block": "over-sixteen", + "when": { + "<": [ + { + "date": [ + { + "identifier": "date-of-birth-answer", + "source": "answers" + } + ] + }, + { + "date": ["now", { "years": -16 }] + } + ] + } + }, + { + "block": "under-sixteen", + "when": { + ">=": [ + { + "date": [ + { + "identifier": "date-of-birth-answer", + "source": "answers" + } + ] + }, + { + "date": ["now", { "years": -16 }] + } + ] + } + }, + { + "block": "dob-age" + } + ] + }, + { + "type": "Question", + "id": "dob-age", + "question": { + "id": "dob-age-question", + "title": "What is your age?", + "type": "General", + "answers": [ + { + "id": "dob-age-answer", + "unit": "duration-year", + "type": "Unit", + "label": "Your age", + "unit_length": "long", + "mandatory": true, + "maximum": { + "value": 118 + } + } + ] + }, + "routing_rules": [ + { + "block": "over-sixteen", + "when": { + ">=": [ + { + "source": "answers", + "identifier": "dob-age-answer" + }, + 16 + ] + } + }, + { + "block": "under-sixteen" + } + ] + }, + { + "type": "Question", + "id": "over-sixteen", + "question": { + "id": "over-sixteen-question", + "title": "You are over 16!", + "type": "General", + "answers": [ + { + "id": "over-sixteen-answer", + "mandatory": false, + "type": "Date", + "maximum": { + "value": "now" + }, + "minimum": { + "value": "1900-01-01" + } + } + ] + } + }, + { + "type": "Question", + "id": "under-sixteen", + "question": { + "id": "under-sixteen-question", + "title": "You are under 16!", + "type": "General", + "answers": [ + { + "id": "under-sixteen-answer", + "mandatory": false, + "type": "Date", + "maximum": { + "value": "now" + }, + "minimum": { + "value": "1900-01-01" + } + } + ] + }, + "skip_conditions": { + "when": { + "or": [ + { + ">=": [ + { + "source": "answers", + "identifier": "dob-age-answer" + }, + 16 + ] + }, + { + "<": [ + { "date": [{ "identifier": "date-of-birth-answer", "source": "answers" }] }, + { + "date": ["now", { "years": -16 }] + } + ] + } + ] + } + } + } + ], + "id": "test" + } + ] + } + ] +} diff --git a/schemas/test/en/test_dropdown_mandatory.json b/schemas/test/en/test_dropdown_mandatory.json new file mode 100644 index 0000000000..6269db4b3f --- /dev/null +++ b/schemas/test/en/test_dropdown_mandatory.json @@ -0,0 +1,76 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Dropdown Mandatory", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "dropdown", + "title": "Dropdown Mandatory", + "blocks": [ + { + "type": "Question", + "id": "dropdown-mandatory", + "question": { + "type": "General", + "id": "dropdown-mandatory-question", + "title": "Which football team do your support?", + "answers": [ + { + "type": "Dropdown", + "id": "dropdown-mandatory-answer", + "mandatory": true, + "label": "Football team", + "description": "Your favourite team from the Premier League.", + "options": [ + { + "label": "Liverpool", + "value": "Liverpool" + }, + { + "label": "Chelsea", + "value": "Chelsea" + }, + { + "label": "Rugby is better!", + "value": "Rugby is better!" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_dropdown_mandatory_with_overridden_error.json b/schemas/test/en/test_dropdown_mandatory_with_overridden_error.json new file mode 100644 index 0000000000..6ecdd5601f --- /dev/null +++ b/schemas/test/en/test_dropdown_mandatory_with_overridden_error.json @@ -0,0 +1,80 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Dropdown Mandatory With Overridden Error", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "dropdown", + "title": "Dropdown Mandatory With Overridden Error", + "blocks": [ + { + "type": "Question", + "id": "dropdown-mandatory-with-overridden-error", + "question": { + "type": "General", + "id": "dropdown-mandatory-with-overridden-error-question", + "title": "Which football team do your support?", + "answers": [ + { + "type": "Dropdown", + "id": "dropdown-mandatory-with-overridden-answer", + "mandatory": true, + "label": "Football team", + "options": [ + { + "label": "Liverpool", + "value": "Liverpool" + }, + { + "label": "Chelsea", + "value": "Chelsea" + }, + { + "label": "Rugby is better!", + "value": "Rugby is better!" + } + ], + "validation": { + "messages": { + "MANDATORY_DROPDOWN": "Overridden test error message." + } + } + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_dropdown_optional.json b/schemas/test/en/test_dropdown_optional.json new file mode 100644 index 0000000000..2082e4dd5f --- /dev/null +++ b/schemas/test/en/test_dropdown_optional.json @@ -0,0 +1,76 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Dropdown Mandatory", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "dropdown", + "title": "Dropdown Optional", + "blocks": [ + { + "type": "Question", + "id": "dropdown-optional", + "question": { + "type": "General", + "id": "dropdown-optional-question", + "title": "Which football team do your support?", + "answers": [ + { + "type": "Dropdown", + "id": "dropdown-optional-answer", + "mandatory": false, + "label": "Football team", + "description": "Your favourite team from the Premier League.", + "options": [ + { + "label": "Liverpool", + "value": "Liverpool" + }, + { + "label": "Chelsea", + "value": "Chelsea" + }, + { + "label": "Rugby is better!", + "value": "Rugby is better!" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_durations.json b/schemas/test/en/test_durations.json new file mode 100644 index 0000000000..fb8c66752a --- /dev/null +++ b/schemas/test/en/test_durations.json @@ -0,0 +1,97 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "023", + "title": "Durations", + "description": "A test schema for different durations", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "duration-block", + "question": { + "answers": [ + { + "id": "year-month-answer", + "label": "Years and Months", + "mandatory": false, + "units": ["years", "months"], + "type": "Duration" + }, + { + "id": "mandatory-year-month-answer", + "label": "Mandatory Years and Months", + "mandatory": true, + "units": ["years", "months"], + "type": "Duration" + }, + { + "id": "year-answer", + "label": "Years", + "mandatory": false, + "units": ["years"], + "type": "Duration" + }, + { + "id": "mandatory-year-answer", + "label": "Mandatory Years", + "mandatory": true, + "units": ["years"], + "type": "Duration" + }, + { + "id": "month-answer", + "label": "Months", + "mandatory": false, + "units": ["months"], + "type": "Duration" + }, + { + "id": "mandatory-month-answer", + "label": "Mandatory Months", + "mandatory": true, + "units": ["months"], + "type": "Duration" + } + ], + "id": "duration-question", + "title": "Durations", + "type": "General" + } + } + ], + "id": "durations" + } + ] + } + ] +} diff --git a/schemas/test/en/test_dynamic_answer_options_function_driven.json b/schemas/test/en/test_dynamic_answer_options_function_driven.json new file mode 100644 index 0000000000..aebd35f764 --- /dev/null +++ b/schemas/test/en/test_dynamic_answer_options_function_driven.json @@ -0,0 +1,346 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test dynamic answer option driven by the map operator", + "theme": "default", + "description": "A questionnaire to demo dynamic answer options driven by the map operator with no additional static options", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "reference-date", + "question": { + "id": "reference-date-question", + "title": "Enter a reference date to drive the next set of questions", + "type": "General", + "answers": [ + { + "id": "reference-date-answer", + "mandatory": true, + "type": "Date" + } + ] + } + }, + { + "type": "Question", + "id": "dynamic-checkbox", + "question": { + "id": "dynamic-checkbox-question", + "title": { + "text": "In the week of {date}, which days did you work?", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "answers", + "identifier": "reference-date-answer" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "dynamic-checkbox-answer", + "mandatory": false, + "type": "Checkbox", + "dynamic_options": { + "values": { + "map": [ + { + "format-date": ["self", "yyyy-MM-dd"] + }, + { + "date-range": [ + { + "date": [ + { + "source": "answers", + "identifier": "reference-date-answer" + }, + { + "day_of_week": "MONDAY" + } + ] + }, + 7 + ] + } + ] + }, + "transform": { + "format-date": [ + { + "date": ["self"] + }, + "EEEE d MMMM yyyy" + ] + } + } + } + ] + } + }, + { + "type": "Question", + "id": "dynamic-radio", + "question": { + "id": "dynamic-radio-question", + "title": { + "text": "In the week of {date}, which day did you work the most?", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "answers", + "identifier": "reference-date-answer" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "dynamic-radio-answer", + "mandatory": false, + "type": "Radio", + "dynamic_options": { + "values": { + "map": [ + { + "format-date": ["self", "yyyy-MM-dd"] + }, + { + "date-range": [ + { + "date": [ + { + "source": "answers", + "identifier": "reference-date-answer" + }, + { + "day_of_week": "MONDAY" + } + ] + }, + 7 + ] + } + ] + }, + "transform": { + "format-date": [ + { + "date": ["self"] + }, + "EEEE d MMMM yyyy" + ] + } + } + } + ] + } + }, + { + "type": "Question", + "id": "dynamic-dropdown", + "question": { + "id": "dynamic-dropdown-question", + "title": { + "text": "In the week of {date}, which day did you work the least?", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "answers", + "identifier": "reference-date-answer" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "dynamic-dropdown-answer", + "mandatory": false, + "type": "Dropdown", + "label": "Select an option", + "dynamic_options": { + "values": { + "map": [ + { + "format-date": ["self", "yyyy-MM-dd"] + }, + { + "date-range": [ + { + "date": [ + { + "source": "answers", + "identifier": "reference-date-answer" + }, + { + "day_of_week": "MONDAY" + } + ] + }, + 7 + ] + } + ] + }, + "transform": { + "format-date": [ + { + "date": ["self"] + }, + "EEEE d MMMM yyyy" + ] + } + } + } + ] + } + }, + { + "type": "Question", + "id": "dynamic-mutually-exclusive", + "question": { + "id": "dynamic-mutually-exclusive-question", + "title": { + "text": "In the week of {date}, which days did you book annual leave?", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "answers", + "identifier": "reference-date-answer" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "MutuallyExclusive", + "mandatory": false, + "answers": [ + { + "id": "dynamic-mutually-exclusive-dynamic-answer", + "mandatory": false, + "type": "Checkbox", + "label": "Select an option", + "dynamic_options": { + "values": { + "map": [ + { + "format-date": ["self", "yyyy-MM-dd"] + }, + { + "date-range": [ + { + "date": [ + { + "source": "answers", + "identifier": "reference-date-answer" + }, + { + "day_of_week": "MONDAY" + } + ] + }, + 7 + ] + } + ] + }, + "transform": { + "format-date": [ + { + "date": ["self"] + }, + "EEEE d MMMM yyyy" + ] + } + } + }, + { + "id": "dynamic-mutually-exclusive-static-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I did not work", + "value": "I did not work" + } + ] + } + ] + } + } + ], + "id": "group-1" + } + ] + } + ] +} diff --git a/schemas/test/en/test_dynamic_answer_options_function_driven_with_static_options.json b/schemas/test/en/test_dynamic_answer_options_function_driven_with_static_options.json new file mode 100644 index 0000000000..94117b7672 --- /dev/null +++ b/schemas/test/en/test_dynamic_answer_options_function_driven_with_static_options.json @@ -0,0 +1,370 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test dynamic answer option driven by the map operator", + "theme": "default", + "description": "A questionnaire to demo dynamic answer options driven by the map operator with additional static options", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "reference-date", + "question": { + "id": "reference-date-question", + "title": "Enter a reference date to drive the next set of questions", + "type": "General", + "answers": [ + { + "id": "reference-date-answer", + "mandatory": true, + "type": "Date" + } + ] + } + }, + { + "type": "Question", + "id": "dynamic-checkbox", + "question": { + "id": "dynamic-checkbox-question", + "title": { + "text": "In the week of {date}, which days did you work?", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "answers", + "identifier": "reference-date-answer" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "dynamic-checkbox-answer", + "mandatory": false, + "type": "Checkbox", + "dynamic_options": { + "values": { + "map": [ + { + "format-date": ["self", "yyyy-MM-dd"] + }, + { + "date-range": [ + { + "date": [ + { + "source": "answers", + "identifier": "reference-date-answer" + }, + { + "day_of_week": "MONDAY" + } + ] + }, + 7 + ] + } + ] + }, + "transform": { + "format-date": [ + { + "date": ["self"] + }, + "EEEE d MMMM yyyy" + ] + } + }, + "options": [ + { + "label": "I did not work", + "value": "I did not work" + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "dynamic-radio", + "question": { + "id": "dynamic-radio-question", + "title": { + "text": "In the week of {date}, which day did you work the most?", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "answers", + "identifier": "reference-date-answer" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "dynamic-radio-answer", + "mandatory": false, + "type": "Radio", + "dynamic_options": { + "values": { + "map": [ + { + "format-date": ["self", "yyyy-MM-dd"] + }, + { + "date-range": [ + { + "date": [ + { + "source": "answers", + "identifier": "reference-date-answer" + }, + { + "day_of_week": "MONDAY" + } + ] + }, + 7 + ] + } + ] + }, + "transform": { + "format-date": [ + { + "date": ["self"] + }, + "EEEE d MMMM yyyy" + ] + } + }, + "options": [ + { + "label": "I did not work", + "value": "I did not work" + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "dynamic-dropdown", + "question": { + "id": "dynamic-dropdown-question", + "title": { + "text": "In the week of {date}, which day did you work the least?", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "answers", + "identifier": "reference-date-answer" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "dynamic-dropdown-answer", + "mandatory": false, + "type": "Dropdown", + "label": "Select an option", + "dynamic_options": { + "values": { + "map": [ + { + "format-date": ["self", "yyyy-MM-dd"] + }, + { + "date-range": [ + { + "date": [ + { + "source": "answers", + "identifier": "reference-date-answer" + }, + { + "day_of_week": "MONDAY" + } + ] + }, + 7 + ] + } + ] + }, + "transform": { + "format-date": [ + { + "date": ["self"] + }, + "EEEE d MMMM yyyy" + ] + } + }, + "options": [ + { + "label": "I did not work", + "value": "I did not work" + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "dynamic-mutually-exclusive", + "question": { + "id": "dynamic-mutually-exclusive-question", + "title": { + "text": "In the week of {date}, which days did you book annual leave?", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "answers", + "identifier": "reference-date-answer" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "MutuallyExclusive", + "mandatory": false, + "answers": [ + { + "id": "dynamic-mutually-exclusive-dynamic-answer", + "mandatory": false, + "type": "Checkbox", + "label": "Select an option", + "dynamic_options": { + "values": { + "map": [ + { + "format-date": ["self", "yyyy-MM-dd"] + }, + { + "date-range": [ + { + "date": [ + { + "source": "answers", + "identifier": "reference-date-answer" + }, + { + "day_of_week": "MONDAY" + } + ] + }, + 7 + ] + } + ] + }, + "transform": { + "format-date": [ + { + "date": ["self"] + }, + "EEEE d MMMM yyyy" + ] + } + }, + "options": [ + { + "label": "None of the above", + "value": "None of the above" + } + ] + }, + { + "id": "dynamic-mutually-exclusive-static-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I did not work", + "value": "I did not work" + } + ] + } + ] + } + } + ], + "id": "group-1" + } + ] + } + ] +} diff --git a/schemas/test/en/test_dynamic_answer_options_function_driven_with_static_options_mandatory.json b/schemas/test/en/test_dynamic_answer_options_function_driven_with_static_options_mandatory.json new file mode 100644 index 0000000000..45962f6437 --- /dev/null +++ b/schemas/test/en/test_dynamic_answer_options_function_driven_with_static_options_mandatory.json @@ -0,0 +1,370 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test dynamic answer option driven by the map operator", + "theme": "default", + "description": "A questionnaire to demo dynamic answer options driven by the map operator with additional static options", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "reference-date", + "question": { + "id": "reference-date-question", + "title": "Enter a reference date to drive the next set of questions", + "type": "General", + "answers": [ + { + "id": "reference-date-answer", + "mandatory": true, + "type": "Date" + } + ] + } + }, + { + "type": "Question", + "id": "dynamic-checkbox", + "question": { + "id": "dynamic-checkbox-question", + "title": { + "text": "In the week of {date}, which days did you work?", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "answers", + "identifier": "reference-date-answer" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "dynamic-checkbox-answer", + "mandatory": true, + "type": "Checkbox", + "dynamic_options": { + "values": { + "map": [ + { + "format-date": ["self", "yyyy-MM-dd"] + }, + { + "date-range": [ + { + "date": [ + { + "source": "answers", + "identifier": "reference-date-answer" + }, + { + "day_of_week": "MONDAY" + } + ] + }, + 7 + ] + } + ] + }, + "transform": { + "format-date": [ + { + "date": ["self"] + }, + "EEEE d MMMM yyyy" + ] + } + }, + "options": [ + { + "label": "I did not work", + "value": "I did not work" + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "dynamic-radio", + "question": { + "id": "dynamic-radio-question", + "title": { + "text": "In the week of {date}, which day did you work the most?", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "answers", + "identifier": "reference-date-answer" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "dynamic-radio-answer", + "mandatory": true, + "type": "Radio", + "dynamic_options": { + "values": { + "map": [ + { + "format-date": ["self", "yyyy-MM-dd"] + }, + { + "date-range": [ + { + "date": [ + { + "source": "answers", + "identifier": "reference-date-answer" + }, + { + "day_of_week": "MONDAY" + } + ] + }, + 7 + ] + } + ] + }, + "transform": { + "format-date": [ + { + "date": ["self"] + }, + "EEEE d MMMM yyyy" + ] + } + }, + "options": [ + { + "label": "I did not work", + "value": "I did not work" + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "dynamic-dropdown", + "question": { + "id": "dynamic-dropdown-question", + "title": { + "text": "In the week of {date}, which day did you work the least?", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "answers", + "identifier": "reference-date-answer" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "dynamic-dropdown-answer", + "mandatory": true, + "type": "Dropdown", + "label": "Select an option", + "dynamic_options": { + "values": { + "map": [ + { + "format-date": ["self", "yyyy-MM-dd"] + }, + { + "date-range": [ + { + "date": [ + { + "source": "answers", + "identifier": "reference-date-answer" + }, + { + "day_of_week": "MONDAY" + } + ] + }, + 7 + ] + } + ] + }, + "transform": { + "format-date": [ + { + "date": ["self"] + }, + "EEEE d MMMM yyyy" + ] + } + }, + "options": [ + { + "label": "I did not work", + "value": "I did not work" + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "dynamic-mutually-exclusive", + "question": { + "id": "dynamic-mutually-exclusive-question", + "title": { + "text": "In the week of {date}, which days did you book annual leave?", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "answers", + "identifier": "reference-date-answer" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "MutuallyExclusive", + "mandatory": true, + "answers": [ + { + "id": "dynamic-mutually-exclusive-dynamic-answer", + "mandatory": false, + "type": "Checkbox", + "label": "Select an option", + "dynamic_options": { + "values": { + "map": [ + { + "format-date": ["self", "yyyy-MM-dd"] + }, + { + "date-range": [ + { + "date": [ + { + "source": "answers", + "identifier": "reference-date-answer" + }, + { + "day_of_week": "MONDAY" + } + ] + }, + 7 + ] + } + ] + }, + "transform": { + "format-date": [ + { + "date": ["self"] + }, + "EEEE d MMMM yyyy" + ] + } + }, + "options": [ + { + "label": "None of the above", + "value": "None of the above" + } + ] + }, + { + "id": "dynamic-mutually-exclusive-static-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I did not work", + "value": "I did not work" + } + ] + } + ] + } + } + ], + "id": "group-1" + } + ] + } + ] +} diff --git a/schemas/test/en/test_dynamic_answers_list_source.json b/schemas/test/en/test_dynamic_answers_list_source.json new file mode 100644 index 0000000000..b77837d41d --- /dev/null +++ b/schemas/test/en/test_dynamic_answers_list_source.json @@ -0,0 +1,588 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Dynamic Answers List Source", + "theme": "default", + "description": "A questionnaire to demo dynamic answers list source.", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { "required_completed_sections": ["list-collector-section"] } + }, + "sections": [ + { + "id": "list-collector-section", + "title": "Supermarket Shopping Section", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "supermarkets", + "title": "Household members", + "add_link_text": "Add another supermarket", + "empty_list_text": "There are no supermarkets" + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "list-collector-group", + "blocks": [ + { + "type": "ListCollectorDrivingQuestion", + "id": "any-supermarket", + "for_list": "supermarkets", + "question": { + "type": "General", + "id": "any-supermarket-question", + "title": "Do you need to add any supermarkets?", + "answers": [ + { + "type": "Radio", + "id": "any-supermarket-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-supermarket", + "list_name": "supermarkets" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "section": "End", + "when": { + "==": [ + { + "source": "answers", + "identifier": "any-supermarket-answer" + }, + "No" + ] + } + }, + { + "block": "list-collector" + } + ] + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "supermarkets", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Do you need to add any more supermarkets?", + "answers": [ + { + "id": "list-collector-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-supermarket", + "type": "ListAddQuestion", + "cancel_text": "Don’t need to add any other supermarkets?", + "question": { + "guidance": { + "contents": [ + { + "description": "Maximum spending value will be used for each supermarket’s max spending validation and placeholders." + } + ] + }, + "id": "add-question", + "type": "General", + "title": "Which supermarkets do you use for your weekly shopping?", + "answers": [ + { + "id": "supermarket-name", + "label": "Supermarket", + "mandatory": true, + "type": "TextField" + }, + { + "id": "set-maximum", + "description": "Maximum amount of spending at this supermarket, should be between 1001 and 10000", + "label": "Maximum Spending", + "mandatory": true, + "type": "Number", + "decimal_places": 2, + "minimum": { + "value": 1001 + }, + "maximum": { + "value": 10000 + } + } + ] + } + }, + "edit_block": { + "id": "edit-supermarket", + "type": "ListEditQuestion", + "cancel_text": "Don’t need to change anything?", + "question": { + "guidance": { + "contents": [ + { + "description": "Maximum spending value will be used for each supermarket’s max spending validation and placeholders." + } + ] + }, + "id": "edit-question", + "type": "General", + "title": "What is the name of the supermarket?", + "answers": [ + { + "id": "supermarket-name", + "label": "Supermarket", + "mandatory": true, + "type": "TextField" + }, + { + "id": "set-maximum", + "description": "Maximum amount of spending at this supermarket", + "label": "Maximum amount of spending", + "mandatory": true, + "type": "Number", + "decimal_places": 2, + "minimum": { + "value": 1001 + }, + "maximum": { + "value": 10000 + } + } + ] + } + }, + "remove_block": { + "id": "remove-supermarket", + "type": "ListRemoveQuestion", + "cancel_text": "Don’t need to remove this supermarket?", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this supermarket?", + "warning": "All of the information about this supermarket will be deleted", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Supermarkets", + "item_title": { + "text": "{supermarket_name}", + "placeholders": [ + { + "placeholder": "supermarket_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "supermarket-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "type": "Question", + "id": "dynamic-answer", + "skip_conditions": { + "when": { + "==": [ + { + "count": [ + { + "source": "list", + "identifier": "supermarkets" + } + ] + }, + 0 + ] + } + }, + "question": { + "dynamic_answers": { + "values": { + "source": "list", + "identifier": "supermarkets" + }, + "answers": [ + { + "label": { + "text": "Percentage of shopping at {transformed_value}", + "placeholders": [ + { + "placeholder": "transformed_value", + "value": { + "source": "answers", + "identifier": "supermarket-name" + } + } + ] + }, + "id": "percentage-of-shopping", + "mandatory": false, + "type": "Percentage", + "maximum": { + "value": 100 + }, + "decimal_places": 0 + }, + { + "id": "days-a-week", + "label": { + "text": "How many days a week you shop at {transformed_value}", + "placeholders": [ + { + "placeholder": "transformed_value", + "value": { + "source": "answers", + "identifier": "supermarket-name" + } + } + ] + }, + "mandatory": false, + "type": "Number", + "decimal_places": 0, + "minimum": { + "value": 1 + }, + "maximum": { + "value": 7 + } + } + ] + }, + "answers": [ + { + "id": "based-checkbox-answer", + "label": "Are supermarkets UK or non UK based?", + "instruction": "Select any answers that apply", + "mandatory": false, + "options": [ + { + "label": "UK based supermarkets", + "value": "UK based supermarkets" + }, + { + "label": "Non UK based supermarkets", + "value": "Non UK based supermarkets" + } + ], + "type": "Checkbox" + } + ], + "id": "dynamic-answer-question", + "title": "What percent of your shopping do you do at each of the following supermarket?", + "type": "General" + } + }, + { + "type": "Question", + "id": "minimum-spending", + "question": { + "guidance": { + "contents": [ + { + "description": "This value will be used for all supermarkets minimum spending validation and placeholders." + } + ] + }, + "answers": [ + { + "id": "set-minimum", + "label": "Minimum Spending", + "description": "Minium amount of spending at all supermarkets", + "mandatory": true, + "type": "Number", + "decimal_places": 2, + "minimum": { + "value": 0 + }, + "maximum": { + "value": 1000 + } + } + ], + "id": "minimum-spending-question", + "title": "What is your minimum amount of spending?", + "type": "General" + } + }, + { + "type": "Question", + "id": "dynamic-answer-only", + "skip_conditions": { + "when": { + "==": [ + { + "count": [ + { + "source": "list", + "identifier": "supermarkets" + } + ] + }, + 0 + ] + } + }, + "question": { + "guidance": { + "contents": [ + { + "description": "Answers are validated against values piped from previous questions, maximum from repeated question for each supermarket, minimum from non-repeated question. Answer label’s placeholders are resolved from these as well." + } + ] + }, + "dynamic_answers": { + "values": { + "source": "list", + "identifier": "supermarkets" + }, + "answers": [ + { + "label": { + "text": "How much do you spend at {transformed_value}", + "placeholders": [ + { + "placeholder": "transformed_value", + "value": { + "source": "answers", + "identifier": "supermarket-name" + } + } + ] + }, + "id": "amount-of-shopping", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "description": { + "text": "The answers must be less than or equal {max_value} and greater than or equal {min_value}", + "placeholders": [ + { + "placeholder": "min_value", + "value": { + "source": "answers", + "identifier": "set-minimum" + } + }, + { + "placeholder": "max_value", + "value": { + "source": "answers", + "identifier": "set-maximum" + } + } + ] + }, + "maximum": { + "value": { + "source": "answers", + "identifier": "set-maximum" + } + }, + "minimum": { + "value": { + "source": "answers", + "identifier": "set-minimum" + } + } + } + ] + }, + "id": "dynamic-answer-only-question", + "title": "How much do you spend at each of the following supermarket?", + "type": "General" + } + } + ] + } + ] + }, + { + "id": "dynamic-answers-section", + "title": "Online Shopping Section", + "enabled": { + "when": { + "==": [ + "Yes", + { + "source": "answers", + "identifier": "any-supermarket-answer" + } + ] + } + }, + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "id": "dynamic-answers-group", + "blocks": [ + { + "type": "Question", + "id": "dynamic-answer-separate-section", + "skip_conditions": { + "when": { + "==": [ + { + "count": [ + { + "source": "list", + "identifier": "supermarkets" + } + ] + }, + 0 + ] + } + }, + "question": { + "dynamic_answers": { + "values": { + "source": "list", + "identifier": "supermarkets" + }, + "answers": [ + { + "label": { + "text": "Percentage of online shopping at {transformed_value}", + "placeholders": [ + { + "placeholder": "transformed_value", + "value": { + "source": "answers", + "identifier": "supermarket-name" + } + } + ] + }, + "id": "percentage-of-online-shopping", + "mandatory": false, + "type": "Percentage", + "maximum": { + "value": 100 + }, + "decimal_places": 0 + }, + { + "id": "online-days-a-week", + "label": { + "text": "How many days a week do you shop online at {transformed_value}", + "placeholders": [ + { + "placeholder": "transformed_value", + "value": { + "source": "answers", + "identifier": "supermarket-name" + } + } + ] + }, + "mandatory": false, + "type": "Number", + "decimal_places": 0, + "minimum": { + "value": 1 + }, + "maximum": { + "value": 7 + } + } + ] + }, + "id": "dynamic-answer-online-question", + "title": "What percent of your online shopping do you do at each of the following supermarket?", + "type": "General" + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_dynamic_radio_options_from_checkbox.json b/schemas/test/en/test_dynamic_radio_options_from_checkbox.json new file mode 100644 index 0000000000..75eb976a2b --- /dev/null +++ b/schemas/test/en/test_dynamic_radio_options_from_checkbox.json @@ -0,0 +1,134 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test dynamic radio answer options from checkbox", + "theme": "default", + "description": "A questionnaire to demo dynamic radio answer options from checkbox answers", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "injury-sustained-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "injury-sustained", + "question": { + "answers": [ + { + "id": "injury-sustained-answer", + "mandatory": true, + "options": [ + { + "label": "Head", + "value": "Head" + }, + { + "label": "Body", + "value": "Body" + }, + { + "label": "Arms", + "value": "Arms" + }, + { + "label": "Legs", + "value": "Legs" + } + ], + "type": "Checkbox" + } + ], + "id": "injury-sustained-question", + "title": "When you had the injury, where did you sustain injuries?", + "type": "General" + } + }, + { + "type": "Question", + "id": "most-serious-injury", + "question": { + "id": "most-serious-injury-question", + "title": "Which was the most serious injury", + "type": "General", + "answers": [ + { + "id": "most-serious-injury-answer", + "mandatory": false, + "type": "Radio", + "dynamic_options": { + "values": { + "source": "answers", + "identifier": "injury-sustained-answer" + }, + "transform": { + "option-label-from-value": ["self", "injury-sustained-answer"] + } + }, + "options": [ + { + "label": "They were of equal severity (static option)", + "value": "They were of equal severity (static option)" + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "healed-the-quickest", + "question": { + "id": "healed-the-quickest-question", + "title": "Which injury healed the quickest", + "type": "General", + "answers": [ + { + "id": "healed-the-quickest-answer", + "mandatory": false, + "type": "Radio", + "dynamic_options": { + "values": { + "source": "answers", + "identifier": "injury-sustained-answer" + }, + "transform": { + "option-label-from-value": ["self", "injury-sustained-answer"] + } + } + } + ] + } + } + ], + "id": "injury-group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_feedback.json b/schemas/test/en/test_feedback.json new file mode 100644 index 0000000000..950b2c0b2a --- /dev/null +++ b/schemas/test/en/test_feedback.json @@ -0,0 +1,74 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Feedback test schema", + "theme": "default", + "form_type": "H", + "description": "A questionnaire to test feedback", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "post_submission": { + "feedback": true + }, + "sections": [ + { + "id": "schema-feedback-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "feedback", + "question": { + "answers": [ + { + "type": "Radio", + "id": "schema-feedback-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ], + "id": "schema-feedback-question", + "title": "Are you aware you can send feedback with this schema?", + "type": "General" + } + } + ], + "id": "schema-feedback-group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_feedback_email_confirmation.json b/schemas/test/en/test_feedback_email_confirmation.json new file mode 100644 index 0000000000..0a18b7b9e7 --- /dev/null +++ b/schemas/test/en/test_feedback_email_confirmation.json @@ -0,0 +1,74 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Feedback test schema", + "theme": "default", + "description": "A questionnaire to test feedback", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "post_submission": { + "feedback": true, + "confirmation_email": true + }, + "sections": [ + { + "id": "schema-feedback-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "feedback", + "question": { + "answers": [ + { + "type": "Radio", + "id": "schema-feedback-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ], + "id": "schema-feedback-question", + "title": "Are you aware you can send feedback with this schema?", + "type": "General" + } + } + ], + "id": "schema-feedback-group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_grand_calculated_summary.json b/schemas/test/en/test_grand_calculated_summary.json new file mode 100644 index 0000000000..e2271d03b9 --- /dev/null +++ b/schemas/test/en/test_grand_calculated_summary.json @@ -0,0 +1,294 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Simple Grand Calculated Summary demo", + "theme": "default", + "description": "A schema to showcase Grand Calculated Summary.", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section-1", + "title": "Commuting", + "groups": [ + { + "id": "group", + "title": "Commuting", + "blocks": [ + { + "type": "Question", + "id": "first-number-block", + "question": { + "id": "first-number-question", + "title": "How much do you walk per week?", + "type": "General", + "answers": [ + { + "id": "q1-a1", + "label": "Weekly distance travelled on foot", + "mandatory": true, + "type": "Unit", + "unit_length": "short", + "unit": "length-mile", + "decimal_places": 2 + }, + { + "id": "q1-a2", + "label": "Number of walks per week", + "mandatory": true, + "type": "Number" + } + ] + } + }, + { + "type": "Question", + "id": "second-number-block", + "question": { + "id": "second-number-question", + "title": "How much do you drive per week?", + "type": "General", + "answers": [ + { + "id": "q2-a1", + "label": "Weekly distance travelled by car", + "mandatory": true, + "type": "Unit", + "unit_length": "short", + "unit": "length-mile", + "decimal_places": 2 + }, + { + "id": "q2-a2", + "label": "Number of car journeys per week", + "mandatory": true, + "type": "Number" + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "distance-calculated-summary-1", + "title": "We calculate the total of distance travelled by foot and car to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "q1-a1" + }, + { + "source": "answers", + "identifier": "q2-a1" + } + ] + }, + "title": "Calculated distance on foot and driving" + } + }, + { + "type": "CalculatedSummary", + "id": "number-calculated-summary-1", + "title": "We calculate the total number of journeys on foot and in a car to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "q1-a2" + }, + { + "source": "answers", + "identifier": "q2-a2" + } + ] + }, + "title": "Calculated journeys on foot and driving" + } + } + ] + } + ] + }, + { + "id": "section-2", + "title": "Alternative Transport", + "groups": [ + { + "id": "transport-group", + "title": "Alternative Transport", + "blocks": [ + { + "type": "Question", + "id": "third-number-block", + "question": { + "id": "third-number-question", + "title": "How much do you cycle per week?", + "type": "General", + "answers": [ + { + "id": "q3-a1", + "label": "Weekly distance travelled by bike", + "mandatory": true, + "type": "Unit", + "unit_length": "short", + "unit": "length-mile", + "decimal_places": 2 + }, + { + "id": "q3-a2", + "label": "Number of bicycle journeys per week", + "mandatory": true, + "type": "Number" + } + ] + } + }, + { + "type": "Question", + "id": "fourth-number-block", + "question": { + "id": "fourth-number-question", + "title": "How much do you voi per week?", + "type": "General", + "answers": [ + { + "id": "q4-a1", + "label": "Weekly distance travelled on a Voi", + "mandatory": true, + "type": "Unit", + "unit_length": "short", + "unit": "length-mile", + "decimal_places": 2 + }, + { + "id": "q4-a2", + "label": "Number of scooter trips per week", + "mandatory": true, + "type": "Number" + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "distance-calculated-summary-2", + "title": "We calculate the total of distance travelled by bike and voi to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "q3-a1" + }, + { + "source": "answers", + "identifier": "q4-a1" + } + ] + }, + "title": "Calculated weekly distance on bike and scooter" + } + }, + { + "type": "CalculatedSummary", + "id": "number-calculated-summary-2", + "title": "We calculate the total number of journeys on bike and on a voi to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "q3-a2" + }, + { + "source": "answers", + "identifier": "q4-a2" + } + ] + }, + "title": "Calculated journeys on bike and scooter" + } + } + ] + } + ] + }, + { + "id": "section-3", + "title": "Grand calculated summaries", + "groups": [ + { + "id": "summary-group", + "title": "Grand calculated summary group", + "blocks": [ + { + "type": "GrandCalculatedSummary", + "id": "distance-grand-calculated-summary", + "title": "We calculate the grand total weekly distance travelled to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "calculated_summary", + "identifier": "distance-calculated-summary-1" + }, + { + "source": "calculated_summary", + "identifier": "distance-calculated-summary-2" + } + ] + }, + "title": "Grand calculated summary of distance travelled" + } + }, + { + "type": "GrandCalculatedSummary", + "id": "number-grand-calculated-summary", + "title": "We calculate the grand total journeys per week to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "calculated_summary", + "identifier": "number-calculated-summary-1" + }, + { + "source": "calculated_summary", + "identifier": "number-calculated-summary-2" + } + ] + }, + "title": "Grand calculated summary of journeys" + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_grand_calculated_summary_cross_section_dependencies.json b/schemas/test/en/test_grand_calculated_summary_cross_section_dependencies.json new file mode 100644 index 0000000000..61512e3003 --- /dev/null +++ b/schemas/test/en/test_grand_calculated_summary_cross_section_dependencies.json @@ -0,0 +1,368 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Grand Calculated Summary Cross Section Dependencies", + "theme": "default", + "description": "A questionnaire to demo resolution of grand calculated summary values across sections", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "questions-section", + "title": "Household bills", + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "id": "radio", + "title": "Questions", + "blocks": [ + { + "type": "Question", + "id": "skip-first-block", + "question": { + "type": "General", + "id": "skip-question-1", + "title": "Are you a student?", + "guidance": { + "contents": [ + { + "description": "If you answer yes, then the question about council tax will be skipped and not included in total monthly expenditure." + } + ] + }, + "answers": [ + { + "type": "Radio", + "id": "skip-answer-1", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "skip-answer-1", + "source": "answers" + }, + "Yes" + ] + } + }, + "type": "Question", + "id": "first-number-block-part-a", + "question": { + "id": "question-1-a", + "title": "How much do you pay monthly for council tax?", + "type": "General", + "answers": [ + { + "id": "first-number-answer-a", + "label": "Council tax (optional)", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "second-number-block", + "question": { + "id": "question-2", + "title": "How much are your monthly gas, water and electricity bills?", + "type": "General", + "answers": [ + { + "id": "second-number-answer-a", + "label": "Electricity Bill", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "second-number-answer-b", + "label": "Gas Bill", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "second-number-answer-c", + "label": "Water Bill", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "currency-section-1", + "title": "We calculate your total monthly expenditure on household bills to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "second-number-answer-a" + }, + { + "source": "answers", + "identifier": "second-number-answer-b" + }, + { + "source": "answers", + "identifier": "second-number-answer-c" + }, + { + "source": "answers", + "identifier": "first-number-answer-a" + } + ] + }, + "title": "Monthly expenditure on household bills" + } + } + ] + } + ] + }, + { + "id": "calculated-summary-section", + "title": "Other outgoing costs", + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "id": "calculated-summary", + "blocks": [ + { + "type": "Question", + "id": "third-number-block", + "question": { + "id": "third-number-question", + "title": "How much do you spend on internet and television?", + "type": "General", + "guidance": { + "contents": [ + { + "description": "If you enter a value for the TV licence, it will unlock an additional question about premium channels." + } + ] + }, + "answers": [ + { + "id": "third-number-answer-part-a", + "label": "Internet bill", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "third-number-answer-part-b", + "label": "TV licence (optional)", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "third-number-answer-part-b", + "source": "answers" + }, + null + ] + } + }, + "type": "Question", + "id": "fourth-number-block", + "question": { + "id": "fourth-number-question", + "title": "How much do you spend per month on premium television channels?", + "type": "General", + "answers": [ + { + "id": "fourth-number-answer", + "label": "TV channel subscription fees", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "skip-calculated-summary", + "question": { + "type": "General", + "id": "skip-question-2", + "title": "Skip the calculated summary of other outgoing costs so it isn’t included in the grand calculated summary?", + "answers": [ + { + "type": "Radio", + "id": "skip-answer-2", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "skip-answer-2", + "source": "answers" + }, + "Yes" + ] + } + }, + "type": "CalculatedSummary", + "id": "currency-question-3", + "title": "We calculate the total monthly spending on internet and TV to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "third-number-answer-part-a" + }, + { + "source": "answers", + "identifier": "third-number-answer-part-b" + }, + { + "source": "answers", + "identifier": "fourth-number-answer" + } + ] + }, + "title": "Total monthly spending on internet and TV" + } + }, + { + "id": "tv-choice-block", + "type": "Question", + "question": { + "id": "tv-choice-question", + "title": "Do you prefer to watch films on a television or computer?", + "type": "General", + "answers": [ + { + "id": "tv-choice-answer", + "label": "Preferred platform", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Television", + "value": "Television" + }, + { + "label": "Computer", + "value": "Computer" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "grand-calculated-summary-section", + "title": "Grand Calculated Summary", + "groups": [ + { + "id": "grand-calculated-summary", + "blocks": [ + { + "type": "GrandCalculatedSummary", + "id": "currency-all", + "title": "The grand calculated summary is calculated to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "calculated_summary", + "identifier": "currency-section-1" + }, + { + "source": "calculated_summary", + "identifier": "currency-question-3" + } + ] + }, + "title": "Grand total monthly expenditure" + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_grand_calculated_summary_inside_repeating_section.json b/schemas/test/en/test_grand_calculated_summary_inside_repeating_section.json new file mode 100644 index 0000000000..41930c4a5e --- /dev/null +++ b/schemas/test/en/test_grand_calculated_summary_inside_repeating_section.json @@ -0,0 +1,1109 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Grand Calculated Summary Inside Repeating Section", + "theme": "default", + "description": "A schema to showcase a grand calculated summary inside a repeating section", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "base-costs-section", + "title": "Vehicle Costs", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "costs", + "title": "Base Costs", + "add_link_text": "Add another base cost", + "empty_list_text": "There are no base costs" + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "base-costs-group", + "blocks": [ + { + "type": "ListCollectorDrivingQuestion", + "id": "any-cost", + "for_list": "costs", + "question": { + "type": "General", + "id": "any-cost-question", + "title": "Do you have any outgoing costs for owning a vehicle?", + "answers": [ + { + "type": "Radio", + "id": "any-cost-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-cost", + "list_name": "costs" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "finance-cost", + "when": { + "==": [ + { + "source": "answers", + "identifier": "any-cost-answer" + }, + "No" + ] + } + }, + { + "block": "list-collector-cost" + } + ] + }, + { + "id": "list-collector-cost", + "type": "ListCollector", + "for_list": "costs", + "question": { + "id": "confirmation-cost-question", + "type": "General", + "title": "Do you need to add other outgoing costs?", + "answers": [ + { + "id": "list-collector-cost-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-cost", + "type": "ListAddQuestion", + "cancel_text": "Don’t need to add any other outgoing costs?", + "question": { + "id": "add-cost-question", + "type": "General", + "title": "What outgoing cost do you have?", + "answers": [ + { + "id": "cost-name", + "label": "Outgoing cost", + "mandatory": true, + "type": "Dropdown", + "options": [ + { + "label": "Road Tax", + "value": "Road Tax" + }, + { + "label": "Parking Permit", + "value": "Parking Permit" + } + ] + } + ] + } + }, + "edit_block": { + "id": "edit-cost", + "type": "ListEditQuestion", + "cancel_text": "Don’t need to change anything?", + "question": { + "id": "edit-cost-question", + "type": "General", + "title": "What outgoing cost do you have?", + "answers": [ + { + "id": "cost-name", + "label": "Outgoing cost", + "mandatory": true, + "type": "Dropdown", + "options": [ + { + "label": "Road Tax", + "value": "Road Tax" + }, + { + "label": "Parking Permit", + "value": "Parking Permit" + } + ] + } + ] + } + }, + "remove_block": { + "id": "remove-cost", + "type": "ListRemoveQuestion", + "cancel_text": "Don’t need to remove this outgoing cost?", + "question": { + "id": "remove-cost-question", + "type": "General", + "title": "Are you sure you want to remove this outgoing cost?", + "warning": "All of the information about this outgoing cost will be deleted", + "answers": [ + { + "id": "remove-cost-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "repeating_blocks": [ + { + "id": "cost-repeating-block-1", + "type": "ListRepeatingQuestion", + "question": { + "id": "cost-repeating-block-1-question", + "type": "General", + "title": { + "text": "What is the base monthly rate for {cost_name} for a single vehicle?", + "placeholders": [ + { + "placeholder": "cost_name", + "value": { + "source": "answers", + "identifier": "cost-name" + } + } + ] + }, + "answers": [ + { + "id": "repeating-block-1-cost-base", + "label": { + "text": "Base {transformed_value} expenditure", + "placeholders": [ + { + "placeholder": "transformed_value", + "value": { + "source": "answers", + "identifier": "cost-name" + } + } + ] + }, + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + } + ], + "summary": { + "title": "cost", + "item_title": { + "text": "{cost_name}", + "placeholders": [ + { + "placeholder": "cost_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "cost-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "type": "Question", + "id": "dynamic-cost-block", + "skip_conditions": { + "when": { + "==": [ + { + "count": [ + { + "source": "list", + "identifier": "costs" + } + ] + }, + 0 + ] + } + }, + "question": { + "id": "dynamic-answer-question", + "title": "How much extra do you normally spend per month for a single vehicle?", + "type": "General", + "dynamic_answers": { + "values": { + "source": "list", + "identifier": "costs" + }, + "answers": [ + { + "label": { + "text": "Extra {transformed_value} expenditure", + "placeholders": [ + { + "placeholder": "transformed_value", + "value": { + "source": "answers", + "identifier": "cost-name" + } + } + ] + }, + "id": "dynamic-answer-cost-extra", + "type": "Currency", + "mandatory": false, + "currency": "GBP", + "decimal_places": 2 + } + ] + } + } + }, + { + "id": "finance-cost", + "type": "Question", + "question": { + "id": "finance-cost-question", + "type": "General", + "title": "What is your monthly expenditure per vehicle on finance?", + "answers": [ + { + "id": "finance-cost-answer", + "label": "Vehicle monthly finance costs", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-base-cost", + "title": "We calculate the total base cost for any owned vehicle to be %(total)s. Is this correct?", + "calculation": { + "title": "Vehicle base cost", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "repeating-block-1-cost-base" + }, + { + "source": "answers", + "identifier": "dynamic-answer-cost-extra" + }, + { + "source": "answers", + "identifier": "finance-cost-answer" + } + ] + } + } + }, + { + "type": "Question", + "id": "base-cost-payment-breakdown", + "question": { + "type": "Calculated", + "id": "base-cost-payment-breakdown-question", + "title": { + "text": "How much of the {total} is paid by debit or credit card?", + "placeholders": [ + { + "placeholder": "total", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "source": "calculated_summary", + "identifier": "calculated-summary-base-cost" + } + } + } + ] + } + ] + }, + "warning": "The sum of these answers must not exceed the total", + "calculations": [ + { + "calculation_type": "sum", + "value": { + "source": "calculated_summary", + "identifier": "calculated-summary-base-cost" + }, + "answers_to_calculate": ["base-credit", "base-debit"], + "conditions": ["less than", "equals"] + } + ], + "answers": [ + { + "id": "base-credit", + "label": "Credit card", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "base-debit", + "label": "Debit card", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + } + ] + } + ] + }, + { + "id": "vehicles-section", + "title": "Vehicle Ownership", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "vehicles", + "title": "Vehicles", + "add_link_text": "Add another vehicle", + "empty_list_text": "There are no vehicles" + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "vehicles-group", + "blocks": [ + { + "type": "ListCollectorDrivingQuestion", + "id": "any-vehicle", + "for_list": "vehicles", + "question": { + "type": "General", + "id": "any-vehicle-question", + "title": "Do you own any vehicles?", + "answers": [ + { + "type": "Radio", + "id": "any-vehicle-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-vehicle", + "list_name": "vehicles" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "section": "End", + "when": { + "==": [ + { + "source": "answers", + "identifier": "any-vehicle-answer" + }, + "No" + ] + } + }, + { + "block": "list-collector" + } + ] + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "vehicles", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Do you need to add more vehicles?", + "answers": [ + { + "id": "list-collector-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-vehicle", + "type": "ListAddQuestion", + "cancel_text": "Don’t need to add any other vehicles?", + "question": { + "id": "add-question", + "type": "General", + "title": "What vehicle do you own?", + "answers": [ + { + "id": "vehicle-name", + "label": "Vehicle", + "mandatory": true, + "type": "Dropdown", + "options": [ + { + "label": "Car", + "value": "Car" + }, + { + "label": "Motorbike", + "value": "Motorbike" + }, + { + "label": "Van", + "value": "Van" + } + ] + } + ] + } + }, + "edit_block": { + "id": "edit-vehicle", + "type": "ListEditQuestion", + "cancel_text": "Don’t need to change anything?", + "question": { + "id": "edit-question", + "type": "General", + "title": "What vehicle do you own?", + "answers": [ + { + "id": "vehicle-name", + "label": "Vehicle", + "mandatory": true, + "type": "Dropdown", + "options": [ + { + "label": "Car", + "value": "Car" + }, + { + "label": "Motorbike", + "value": "Motorbike" + }, + { + "label": "Van", + "value": "Van" + } + ] + } + ] + } + }, + "remove_block": { + "id": "remove-vehicle", + "type": "ListRemoveQuestion", + "cancel_text": "Don’t need to remove this vehicle?", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this vehicle?", + "warning": "All of the information about this vehicle will be deleted", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Vehicle", + "item_title": { + "text": "{vehicle_name}", + "placeholders": [ + { + "placeholder": "vehicle_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "vehicle-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "vehicle-details-section", + "title": "Vehicle Details", + "summary": { + "show_on_completion": true + }, + "repeat": { + "for_list": "vehicles", + "title": { + "text": "{vehicle_name} details", + "placeholders": [ + { + "placeholder": "vehicle_name", + "value": { + "source": "answers", + "identifier": "vehicle-name" + } + } + ] + } + }, + "groups": [ + { + "id": "vehicle-details-group", + "blocks": [ + { + "id": "vehicle-maintenance-block", + "type": "Question", + "question": { + "id": "vehicle-maintenance-question", + "type": "General", + "title": { + "text": "What is your monthly expenditure on maintenance for your {vehicle_name}?", + "placeholders": [ + { + "placeholder": "vehicle_name", + "value": { + "source": "answers", + "identifier": "vehicle-name" + } + } + ] + }, + "answers": [ + { + "id": "vehicle-maintenance-cost", + "label": { + "text": "{vehicle_name} maintenance costs", + "placeholders": [ + { + "placeholder": "vehicle_name", + "value": { + "source": "answers", + "identifier": "vehicle-name" + } + } + ] + }, + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "id": "vehicle-fuel-block", + "type": "Question", + "question": { + "id": "vehicle-fuel-question", + "type": "General", + "title": { + "text": "What is your monthly expenditure on fuel for your {vehicle_name}?", + "placeholders": [ + { + "placeholder": "vehicle_name", + "value": { + "source": "answers", + "identifier": "vehicle-name" + } + } + ] + }, + "answers": [ + { + "id": "vehicle-fuel-cost", + "label": { + "text": "{vehicle_name} fuel costs", + "placeholders": [ + { + "placeholder": "vehicle_name", + "value": { + "source": "answers", + "identifier": "vehicle-name" + } + } + ] + }, + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-running-cost", + "title": { + "text": "We calculate the monthly running costs of your {vehicle_name} to be %(total)s. Is this correct?", + "placeholders": [ + { + "placeholder": "vehicle_name", + "value": { + "source": "answers", + "identifier": "vehicle-name" + } + } + ] + }, + "calculation": { + "title": { + "text": "Monthly {vehicle_name} costs", + "placeholders": [ + { + "placeholder": "vehicle_name", + "value": { + "source": "answers", + "identifier": "vehicle-name" + } + } + ] + }, + "operation": { + "+": [ + { + "source": "answers", + "identifier": "vehicle-maintenance-cost" + }, + { + "source": "answers", + "identifier": "vehicle-fuel-cost" + } + ] + } + } + }, + { + "type": "GrandCalculatedSummary", + "id": "grand-calculated-summary-vehicle", + "title": { + "text": "The total cost of owning and running your {vehicle_name} is calculated to be %(total)s. Is this correct?", + "placeholders": [ + { + "placeholder": "vehicle_name", + "value": { + "source": "answers", + "identifier": "vehicle-name" + } + } + ] + }, + "calculation": { + "operation": { + "+": [ + { + "source": "calculated_summary", + "identifier": "calculated-summary-base-cost" + }, + { + "source": "calculated_summary", + "identifier": "calculated-summary-running-cost" + } + ] + }, + "title": { + "text": "Grand total {vehicle_name} expenditure", + "placeholders": [ + { + "placeholder": "vehicle_name", + "value": { + "source": "answers", + "identifier": "vehicle-name" + } + } + ] + } + } + }, + { + "type": "Question", + "id": "gcs-breakdown-block", + "question": { + "id": "gcs-breakdown-question", + "guidance": { + "contents": [ + { + "description": "Currently this question is not revisited when the grand calculated summary changes. When grand calculated summary dependencies are implemented, this guidance should be removed, and this block should become incomplete upon the GCS changing." + } + ] + }, + "title": { + "text": "How do you pay for the monthly fees of {vehicle_cost}?", + "placeholders": [ + { + "placeholder": "vehicle_cost", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "identifier": "grand-calculated-summary-vehicle", + "source": "grand_calculated_summary" + } + } + } + ] + } + ] + }, + "type": "Calculated", + "warning": "These answers must add up to the total owning and running cost", + "calculations": [ + { + "calculation_type": "sum", + "value": { + "identifier": "grand-calculated-summary-vehicle", + "source": "grand_calculated_summary" + }, + "answers_to_calculate": ["pay-debit", "pay-credit", "pay-other"], + "conditions": ["equals"] + } + ], + "answers": [ + { + "id": "pay-debit", + "label": "Amount paid by debit card", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "pay-credit", + "label": "Amount paid by credit card", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "pay-other", + "label": "Amount paid by other means", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Interstitial", + "id": "gcs-piping", + "content": { + "title": { + "text": "You have provided the following information about monthly expenditure for your {vehicle_name}.", + "placeholders": [ + { + "placeholder": "vehicle_name", + "value": { + "source": "answers", + "identifier": "vehicle-name" + } + } + ] + }, + "contents": [ + { + "list": [ + { + "text": "Monthly maintenance cost: {total_maintenance}", + "placeholders": [ + { + "placeholder": "total_maintenance", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "identifier": "vehicle-maintenance-cost", + "source": "answers" + } + } + } + ] + } + ] + }, + { + "text": "Monthly fuel cost: {total_fuel}", + "placeholders": [ + { + "placeholder": "total_fuel", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "identifier": "vehicle-fuel-cost", + "source": "answers" + } + } + } + ] + } + ] + }, + { + "text": "Total base cost: {total_base}", + "placeholders": [ + { + "placeholder": "total_base", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "identifier": "calculated-summary-base-cost", + "source": "calculated_summary" + } + } + } + ] + } + ] + }, + { + "text": "Total running cost: {total_running}", + "placeholders": [ + { + "placeholder": "total_running", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "identifier": "calculated-summary-running-cost", + "source": "calculated_summary" + } + } + } + ] + } + ] + }, + { + "text": "Total owning and running cost: {total}", + "placeholders": [ + { + "placeholder": "total", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "identifier": "grand-calculated-summary-vehicle", + "source": "grand_calculated_summary" + } + } + } + ] + } + ] + }, + { + "text": "Paid by debit card: {debit}", + "placeholders": [ + { + "placeholder": "debit", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "identifier": "pay-debit", + "source": "answers" + } + } + } + ] + } + ] + }, + { + "text": "Paid by credit card: {credit}", + "placeholders": [ + { + "placeholder": "credit", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "identifier": "pay-credit", + "source": "answers" + } + } + } + ] + } + ] + }, + { + "text": "Paid by other means: {other}", + "placeholders": [ + { + "placeholder": "other", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "identifier": "pay-other", + "source": "answers" + } + } + } + ] + } + ] + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_grand_calculated_summary_overlapping_answers.json b/schemas/test/en/test_grand_calculated_summary_overlapping_answers.json new file mode 100644 index 0000000000..b21dbc9b6e --- /dev/null +++ b/schemas/test/en/test_grand_calculated_summary_overlapping_answers.json @@ -0,0 +1,357 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Grand Calculated Summary with overlapping answers", + "theme": "default", + "description": "A schema to showcase grand calculated summaries which include multiple calculated summaries using the same answers.", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { + "required_completed_sections": ["introduction-section"] + } + }, + "sections": [ + { + "id": "introduction-section", + "title": "Introduction", + "show_on_hub": false, + "groups": [ + { + "id": "introduction-group", + "title": "Introduction", + "blocks": [ + { + "type": "Introduction", + "id": "introduction-block", + "primary_content": [ + { + "id": "about", + "contents": [ + { + "title": "About", + "list": [ + "This survey tests that when you re-use answers between calculated summaries, the grand calculated summary still resolves to the correct value" + ] + }, + { + "title": "How to test this schema", + "list": [ + "Ensure that the grand calculated summary section does not show unless all dependent calculated summaries in section-1 have been confirmed.", + "Your answer to the third question, may unlock an additional calculated summary which re-use your answers to the first two questions", + "If you do not select to buy extra food, verify no additional calculated summary occurs, and that the grand calculated summary is correct", + "If you choose to buy any food items twice, verify that they are included twice in the grand calculated summary, one for each calculated summary", + "Verify that if you have the extra calculated summary, and change the cost of bread for example using either of the calculated summary change links which include it that you are routed to each calculated summary first, and only then the grand calculated summary" + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "id": "section-1", + "title": "Weekly shop", + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "id": "group-1", + "title": "Weekly shopping", + "blocks": [ + { + "type": "Question", + "id": "block-1", + "question": { + "type": "General", + "id": "question-1", + "title": "How much do you spend on the following in a typical weekly shop?", + "answers": [ + { + "id": "q1-a1", + "label": "Money on milk", + "type": "Currency", + "currency": "GBP", + "mandatory": false, + "decimal_places": 2 + }, + { + "id": "q1-a2", + "label": "Money on eggs", + "type": "Currency", + "currency": "GBP", + "mandatory": false, + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "block-2", + "question": { + "type": "General", + "id": "question-2", + "title": "How much do you spend on these items in a typical week?", + "answers": [ + { + "id": "q2-a1", + "label": "Money on bread", + "type": "Currency", + "currency": "GBP", + "mandatory": false, + "decimal_places": 2 + }, + { + "id": "q2-a2", + "label": "Money on cheese", + "type": "Currency", + "currency": "GBP", + "mandatory": false, + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-1", + "title": "Total of milk and bread is calculated to be %(total)s. Is this correct?", + "calculation": { + "title": "milk + bread", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "q1-a1" + }, + { + "source": "answers", + "identifier": "q2-a1" + } + ] + } + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-2", + "title": "Total of eggs and cheese is calculated to be %(total)s. Is this correct?", + "calculation": { + "title": "eggs + cheese", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "q1-a2" + }, + { + "source": "answers", + "identifier": "q2-a2" + } + ] + } + } + }, + { + "type": "Question", + "id": "block-3", + "question": { + "type": "General", + "id": "question-3", + "title": "Do you want to buy extra of anything this week?", + "guidance": { + "contents": [ + { + "description": "If you select the first option, all your answers so far will be reused in a new calculated summary for extra shopping. If you select the second option, only your answers for bread and cheese will be reused." + } + ] + }, + "answers": [ + { + "type": "Radio", + "id": "radio-extra", + "mandatory": true, + "options": [ + { + "label": "Yes, I am going to buy two of everything", + "value": "Yes, I am going to buy two of everything" + }, + { + "label": "Yes, extra bread and cheese", + "value": "Yes, extra bread and cheese" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "skip_conditions": { + "when": { + "!=": [ + { + "source": "answers", + "identifier": "radio-extra" + }, + "Yes, I am going to buy two of everything" + ] + } + }, + "type": "CalculatedSummary", + "id": "calculated-summary-3", + "title": "Total extra items purchased is calculated to be %(total)s. Is this correct? This reuses your answers to question 1 and 2", + "calculation": { + "title": "(extra) milk + eggs + bread + cheese", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "q1-a1" + }, + { + "source": "answers", + "identifier": "q1-a2" + }, + { + "source": "answers", + "identifier": "q2-a1" + }, + { + "source": "answers", + "identifier": "q2-a2" + } + ] + } + } + }, + { + "skip_conditions": { + "when": { + "!=": [ + { + "source": "answers", + "identifier": "radio-extra" + }, + "Yes, extra bread and cheese" + ] + } + }, + "type": "CalculatedSummary", + "id": "calculated-summary-4", + "title": "Total extra items cost is calculated to be %(total)s. Is this correct? This is reusing your bread and cheese answers", + "calculation": { + "title": "(extra) bread + cheese", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "q2-a1" + }, + { + "source": "answers", + "identifier": "q2-a2" + } + ] + } + } + } + ] + } + ] + }, + { + "id": "section-3", + "title": "Grand calculated summary", + "enabled": { + "when": { + "==": [{ "source": "progress", "selector": "section", "identifier": "section-1" }, "COMPLETED"] + } + }, + "groups": [ + { + "id": "group-2", + "title": "Grand calculated summary", + "blocks": [ + { + "type": "GrandCalculatedSummary", + "id": "grand-calculated-summary-shopping", + "title": "Grand Calculated Summary of purchases this week comes to %(total)s. Is this correct?.", + "calculation": { + "title": "Weekly shopping cost", + "operation": { + "+": [ + { + "source": "calculated_summary", + "identifier": "calculated-summary-1" + }, + { + "source": "calculated_summary", + "identifier": "calculated-summary-2" + }, + { + "source": "calculated_summary", + "identifier": "calculated-summary-3" + }, + { + "source": "calculated_summary", + "identifier": "calculated-summary-4" + } + ] + } + } + } + ] + } + ] + }, + { + "id": "section-4", + "title": "Conditional Section", + "enabled": { + "when": { + ">": [{ "source": "grand_calculated_summary", "identifier": "grand-calculated-summary-shopping" }, 500] + } + }, + "groups": [ + { + "id": "group-3", + "title": "Conditional Group", + "blocks": [ + { + "type": "Interstitial", + "id": "grand-calculated-summary-piping", + "content": { + "title": "This section is only showing because the grand calculated summary exceeded £500." + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_grand_calculated_summary_repeating_answers.json b/schemas/test/en/test_grand_calculated_summary_repeating_answers.json new file mode 100644 index 0000000000..1938d8263c --- /dev/null +++ b/schemas/test/en/test_grand_calculated_summary_repeating_answers.json @@ -0,0 +1,1426 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Grand Calculated Summary cross section demo", + "theme": "default", + "description": "A schema to showcase grand calculated summary across multiple sections featuring static, dynamic and list repeating block answers", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section-1", + "title": "Food and clothing", + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "id": "group-1", + "title": "Food", + "blocks": [ + { + "type": "Question", + "id": "block-1", + "question": { + "type": "General", + "id": "question-1", + "title": "How much do you spend per month on fruit and veg?", + "answers": [ + { + "id": "q1-a1", + "label": "Money spent on fruit", + "type": "Currency", + "currency": "GBP", + "mandatory": false, + "decimal_places": 2 + }, + { + "id": "q1-a2", + "label": "Money spent on veg", + "type": "Currency", + "currency": "GBP", + "mandatory": false, + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "block-2", + "question": { + "type": "General", + "id": "question-2", + "title": "How much do you spend per month on other food?", + "answers": [ + { + "id": "q2-a1", + "label": "Money spent on bread", + "type": "Currency", + "currency": "GBP", + "mandatory": false, + "decimal_places": 2 + }, + { + "id": "q2-a2", + "label": "Money spent on not bread", + "type": "Currency", + "currency": "GBP", + "mandatory": false, + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-1", + "title": "Calculated Summary for food expenditure is calculated to be %(total)s. Is this correct?", + "calculation": { + "title": "Total monthly food expenditure", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "q1-a1" + }, + { + "source": "answers", + "identifier": "q1-a2" + }, + { + "source": "answers", + "identifier": "q2-a1" + }, + { + "source": "answers", + "identifier": "q2-a2" + } + ] + } + } + } + ] + }, + { + "id": "group-2", + "title": "Clothing", + "blocks": [ + { + "type": "Question", + "id": "block-3", + "question": { + "type": "General", + "id": "question-3", + "title": "How much do you spend per month on clothes?", + "answers": [ + { + "id": "q3-a1", + "label": "Money spent on jumpers", + "type": "Currency", + "currency": "GBP", + "mandatory": false, + "decimal_places": 2 + }, + { + "id": "q3-a2", + "label": "Money spent on hats", + "type": "Currency", + "currency": "GBP", + "mandatory": false, + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-2", + "title": "Calculated summary for clothes expenditure is calculated to be %(total)s. Is this correct?", + "calculation": { + "title": "Total monthly clothes expenditure", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "q3-a1" + }, + { + "source": "answers", + "identifier": "q3-a2" + } + ] + } + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-3", + "title": "Calculated summary for food and clothing is calculated to be %(total)s. Is this correct?", + "calculation": { + "title": "Total food and clothes expenditure", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "q1-a1" + }, + { + "source": "answers", + "identifier": "q1-a2" + }, + { + "source": "answers", + "identifier": "q2-a1" + }, + { + "source": "answers", + "identifier": "q2-a2" + }, + { + "source": "answers", + "identifier": "q3-a1" + }, + { + "source": "answers", + "identifier": "q3-a2" + } + ] + } + } + }, + { + "type": "GrandCalculatedSummary", + "id": "grand-calculated-summary-1", + "title": "Grand Calculated Summary which should match the previous calculated summary is calculated to be %(total)s. Is this correct?", + "calculation": { + "title": "Grand calculated summary", + "operation": { + "+": [ + { + "source": "calculated_summary", + "identifier": "calculated-summary-1" + }, + { + "source": "calculated_summary", + "identifier": "calculated-summary-2" + } + ] + } + } + } + ] + } + ] + }, + { + "id": "section-2", + "title": "Entertainment", + "groups": [ + { + "id": "group-3", + "title": "Group title for questions about games", + "blocks": [ + { + "type": "Question", + "id": "block-4", + "question": { + "type": "General", + "id": "question-4", + "title": "How much do you spend per week on games?", + "guidance": { + "contents": [ + { + "description": "Note:" + }, + { + "list": [ + "The grand calculated summary section after this will only show if the total spending on games is not zero", + "You should test that if you use the change links on the grand calculated summary to come back here and set both answers to 0, that you are not routed to the grand calculated summary when you press continue on the calculated summary, but instead, taken to the Hub.", + "If you use the change links on the grand calculated summary to edit these answer values to a non-zero sum, pressing continue twice should take you back to the grand calculated summary" + ] + } + ] + }, + "answers": [ + { + "id": "q4-a1", + "label": "Video games", + "type": "Currency", + "currency": "GBP", + "mandatory": false, + "decimal_places": 2 + }, + { + "id": "q4-a2", + "label": "Board games", + "type": "Currency", + "currency": "GBP", + "mandatory": false, + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-4", + "title": "Calculated Summary for games expenditure is calculated to be %(total)s. Is this correct?", + "calculation": { + "title": "Total games expenditure", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "q4-a1" + }, + { + "source": "answers", + "identifier": "q4-a2" + } + ] + } + } + } + ] + } + ] + }, + { + "id": "section-3", + "title": "Grand calculated summary of shopping and entertainment", + "enabled": { + "when": { + "and": [ + { + "!=": [ + 0, + { + "source": "calculated_summary", + "identifier": "calculated-summary-4" + } + ] + }, + { + "==": [ + "COMPLETED", + { + "source": "progress", + "selector": "section", + "identifier": "section-1" + } + ] + }, + { + "==": [ + "COMPLETED", + { + "source": "progress", + "selector": "section", + "identifier": "section-2" + } + ] + } + ] + } + }, + "groups": [ + { + "id": "group-4", + "title": "Group title for the grand calculated summary of both sections", + "blocks": [ + { + "type": "GrandCalculatedSummary", + "id": "grand-calculated-summary-2", + "title": "Grand Calculated Summary for shopping and entertainment is calculated to be %(total)s. Is this correct?", + "calculation": { + "title": "Total food clothes and games expenditure", + "operation": { + "+": [ + { + "source": "calculated_summary", + "identifier": "calculated-summary-1" + }, + { + "source": "calculated_summary", + "identifier": "calculated-summary-2" + }, + { + "source": "calculated_summary", + "identifier": "calculated-summary-4" + } + ] + } + } + } + ] + } + ] + }, + { + "id": "section-4", + "title": "Utility bills", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "utility-bills", + "title": "Utility bills", + "item_anchor_answer_id": "utility-bill-name", + "item_label": "Utility bill", + "add_link_text": "Add another utility bill", + "empty_list_text": "No utility bills added" + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "group-5", + "title": "Utility bills", + "blocks": [ + { + "type": "ListCollectorDrivingQuestion", + "id": "any-utility-bills", + "for_list": "utility-bills", + "question": { + "type": "General", + "id": "any-utility-bills-question", + "title": "Do you have any monthly expenditure on Utility bills?", + "answers": [ + { + "type": "Radio", + "id": "any-utility-bills-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-utility-bill", + "list_name": "utility-bills" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "when": { + "==": [ + { + "source": "answers", + "identifier": "any-utility-bills-answer" + }, + "Yes" + ] + }, + "block": "any-other-utility-bills" + }, + { + "section": "End" + } + ] + }, + { + "id": "any-other-utility-bills", + "type": "ListCollector", + "for_list": "utility-bills", + "question": { + "id": "any-other-utility-bills-question", + "type": "General", + "title": "Do you need to add any other Utility bills?", + "answers": [ + { + "id": "any-other-utility-bills-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-utility-bill", + "type": "ListAddQuestion", + "question": { + "id": "add-utility-bill-question", + "type": "General", + "title": "What bill do you need to add expenditure for?", + "answers": [ + { + "id": "utility-bill-name", + "label": "Utility bill", + "mandatory": true, + "type": "Dropdown", + "options": [ + { + "label": "Electricity", + "value": "Electricity" + }, + { + "label": "Water", + "value": "Water" + }, + { + "label": "Gas", + "value": "Gas" + }, + { + "label": "Internet", + "value": "Internet" + } + ] + } + ] + } + }, + "edit_block": { + "id": "edit-utility-bill", + "type": "ListEditQuestion", + "question": { + "id": "edit-utility-bill-question", + "type": "General", + "title": "What is the name of the game?", + "answers": [ + { + "id": "utility-bill-name", + "label": "Name of Utility bill", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-utility-bill", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-utility-bill-question", + "type": "General", + "title": "Are you sure you want to remove this Utility bill?", + "answers": [ + { + "id": "remove-utility-bill-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Utility bills", + "item_title": { + "text": "{utility_bill}", + "placeholders": [ + { + "placeholder": "utility_bill", + "value": { + "source": "answers", + "identifier": "utility-bill-name" + } + } + ] + } + } + }, + { + "type": "Question", + "id": "dynamic-answer", + "skip_conditions": { + "when": { + "==": [ + { + "count": [ + { + "source": "list", + "identifier": "utility-bills" + } + ] + }, + 0 + ] + } + }, + "question": { + "dynamic_answers": { + "values": { + "source": "list", + "identifier": "utility-bills" + }, + "answers": [ + { + "label": { + "text": "Monthly expenditure on {utility_bill} bills", + "placeholders": [ + { + "placeholder": "utility_bill", + "value": { + "source": "answers", + "identifier": "utility-bill-name" + } + } + ] + }, + "id": "utility-bill-monthly-cost", + "type": "Currency", + "mandatory": true, + "currency": "GBP", + "decimal_places": 2 + } + ] + }, + "id": "dynamic-answer-question", + "title": "Monthly expenditure on utility bills", + "type": "General" + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-5", + "title": "Calculated Summary for monthly spending on utility bills is calculated to be %(total)s. Is this correct?", + "calculation": { + "title": "Total monthly expenditure on utility bills", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "utility-bill-monthly-cost" + } + ] + } + } + } + ] + } + ] + }, + { + "id": "section-5", + "title": "Streaming services", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "streaming-services", + "title": "Streaming services", + "item_anchor_answer_id": "streaming-service-name", + "item_label": "Streaming service", + "add_link_text": "Add another streaming service", + "empty_list_text": "No streaming services added" + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "group-6", + "title": "Streaming services", + "blocks": [ + { + "type": "ListCollectorDrivingQuestion", + "id": "any-streaming-services", + "for_list": "streaming-services", + "question": { + "type": "General", + "id": "any-streaming-services-question", + "title": "Do you have any monthly expenditure on streaming services?", + "answers": [ + { + "type": "Radio", + "id": "any-streaming-services-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-streaming-service", + "list_name": "streaming-services" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "when": { + "==": [ + { + "source": "answers", + "identifier": "any-streaming-services-answer" + }, + "Yes" + ] + }, + "block": "any-other-streaming-services" + }, + { + "section": "End" + } + ] + }, + { + "id": "any-other-streaming-services", + "type": "ListCollector", + "for_list": "streaming-services", + "question": { + "id": "any-other-streaming-services-question", + "type": "General", + "title": "Do you need to add any other streaming services?", + "answers": [ + { + "id": "any-other-streaming-services-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-streaming-service", + "type": "ListAddQuestion", + "question": { + "id": "add-streaming-service-question", + "type": "General", + "title": "What is the name of the Streaming service?", + "answers": [ + { + "id": "streaming-service-name", + "label": "Name of Streaming service", + "mandatory": true, + "type": "Dropdown", + "options": [ + { + "label": "Netflix", + "value": "Netflix" + }, + { + "label": "Prime video", + "value": "Prime video" + }, + { + "label": "Now TV", + "value": "Now TV" + }, + { + "label": "Apple TV", + "value": "Apple TV" + }, + { + "label": "Disney+", + "value": "Disney+" + } + ] + } + ] + } + }, + "edit_block": { + "id": "edit-streaming-service", + "type": "ListEditQuestion", + "question": { + "id": "edit-streaming-service-question", + "type": "General", + "title": "What is the name of the Streaming service?", + "answers": [ + { + "id": "streaming-service-name", + "label": "Name of Streaming service", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-streaming-service", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-streaming-service-question", + "type": "General", + "title": "Are you sure you want to remove this Streaming service?", + "answers": [ + { + "id": "remove-streaming-service-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "repeating_blocks": [ + { + "id": "streaming-service-repeating-block-1", + "type": "ListRepeatingQuestion", + "question": { + "id": "streaming-service-repeating-block-1-question", + "type": "General", + "title": { + "text": "What is your monthly expenditure on {streaming_service} bills?", + "placeholders": [ + { + "placeholder": "streaming_service", + "value": { + "source": "answers", + "identifier": "streaming-service-name" + } + } + ] + }, + "answers": [ + { + "id": "streaming-service-monthly-cost", + "label": { + "text": "Monthly subscription cost for {streaming_service}", + "placeholders": [ + { + "placeholder": "streaming_service", + "value": { + "source": "answers", + "identifier": "streaming-service-name" + } + } + ] + }, + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "streaming-service-extra-cost", + "label": { + "text": "Additional monthly spending on {streaming_service}", + "placeholders": [ + { + "placeholder": "streaming_service", + "value": { + "source": "answers", + "identifier": "streaming-service-name" + } + } + ] + }, + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "id": "streaming-service-repeating-block-2", + "type": "ListRepeatingQuestion", + "question": { + "id": "streaming-service-repeating-block-2-question", + "type": "General", + "title": { + "text": "What is your average monthly internet usage for {streaming_service}?", + "placeholders": [ + { + "placeholder": "streaming_service", + "value": { + "source": "answers", + "identifier": "streaming-service-name" + } + } + ] + }, + "answers": [ + { + "id": "streaming-service-usage", + "label": { + "text": "Monthly Internet usage for {streaming_service}", + "placeholders": [ + { + "placeholder": "streaming_service", + "value": { + "source": "answers", + "identifier": "streaming-service-name" + } + } + ] + }, + "mandatory": true, + "type": "Unit", + "unit_length": "short", + "unit": "digital-gigabyte", + "decimal_places": 2 + } + ] + } + } + ], + "summary": { + "title": "Streaming services", + "item_title": { + "text": "{streaming_service_name}", + "placeholders": [ + { + "placeholder": "streaming_service_name", + "value": { + "source": "answers", + "identifier": "streaming-service-name" + } + } + ] + } + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-6", + "title": "Calculated Summary for monthly expenditure on streaming services is calculated to be %(total)s. Is this correct?", + "calculation": { + "title": "Total monthly expenditure on streaming services", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "streaming-service-monthly-cost" + }, + { + "source": "answers", + "identifier": "streaming-service-extra-cost" + } + ] + } + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-7", + "title": "Total monthly internet usage on streaming services is calculated to be %(total)s. Is this correct?", + "calculation": { + "title": "Total internet usage on streaming services", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "streaming-service-usage" + } + ] + } + } + }, + { + "type": "Question", + "id": "other-internet-usage", + "question": { + "type": "General", + "id": "other-internet-question", + "title": "Do you have any additional internet usage to report?", + "answers": [ + { + "id": "media-downloads", + "label": "Internet usage on media downloads", + "mandatory": false, + "type": "Unit", + "unit_length": "short", + "unit": "digital-gigabyte", + "decimal_places": 2 + }, + { + "id": "misc-internet", + "label": "Other miscellaneous internet usage", + "mandatory": false, + "type": "Unit", + "unit_length": "short", + "unit": "digital-gigabyte", + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-8", + "title": "Total monthly internet usage on other services is calculated to be %(total)s. Is this correct?", + "calculation": { + "title": "Total internet usage on other services", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "media-downloads" + }, + { + "source": "answers", + "identifier": "misc-internet" + } + ] + } + } + } + ] + } + ] + }, + { + "id": "section-6", + "title": "Grand calculated summary of household expenditure", + "enabled": { + "when": { + "and": [ + { + "==": [ + "COMPLETED", + { + "source": "progress", + "selector": "section", + "identifier": "section-1" + } + ] + }, + { + "==": [ + "COMPLETED", + { + "source": "progress", + "selector": "section", + "identifier": "section-2" + } + ] + }, + { + "==": [ + "COMPLETED", + { + "source": "progress", + "selector": "section", + "identifier": "section-4" + } + ] + }, + { + "==": [ + "COMPLETED", + { + "source": "progress", + "selector": "section", + "identifier": "section-5" + } + ] + } + ] + } + }, + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "id": "group-7", + "title": "Expenditure grand totals", + "blocks": [ + { + "type": "GrandCalculatedSummary", + "id": "grand-calculated-summary-3", + "title": "Grand Calculated Summary for monthly spending on bills and services is calculated to be %(total)s. Is this correct?", + "calculation": { + "title": "Total monthly expenditure on bills and streaming services", + "operation": { + "+": [ + { + "source": "calculated_summary", + "identifier": "calculated-summary-5" + }, + { + "source": "calculated_summary", + "identifier": "calculated-summary-6" + } + ] + } + } + }, + { + "type": "GrandCalculatedSummary", + "id": "grand-calculated-summary-4", + "title": "Grand Calculated Summary for internet usage is calculated to be %(total)s. Is this correct?", + "calculation": { + "title": "Total internet usage", + "operation": { + "+": [ + { + "source": "calculated_summary", + "identifier": "calculated-summary-7" + }, + { + "source": "calculated_summary", + "identifier": "calculated-summary-8" + } + ] + } + } + }, + { + "type": "GrandCalculatedSummary", + "id": "grand-calculated-summary-5", + "title": "Grand Calculated Summary for total monthly household expenditure is calculated to be %(total)s. Is this correct?", + "calculation": { + "title": "Total monthly expenditure", + "operation": { + "+": [ + { + "source": "calculated_summary", + "identifier": "calculated-summary-1" + }, + { + "source": "calculated_summary", + "identifier": "calculated-summary-2" + }, + { + "source": "calculated_summary", + "identifier": "calculated-summary-4" + }, + { + "source": "calculated_summary", + "identifier": "calculated-summary-5" + }, + { + "source": "calculated_summary", + "identifier": "calculated-summary-6" + } + ] + } + } + }, + { + "type": "Question", + "id": "internet-breakdown-block", + "question": { + "id": "internet-breakdown-question", + "title": { + "text": "How did you use the {internet_usage} across your devices?", + "placeholders": [ + { + "placeholder": "internet_usage", + "transforms": [ + { + "transform": "format_unit", + "arguments": { + "value": { + "source": "grand_calculated_summary", + "identifier": "grand-calculated-summary-4" + }, + "unit": "digital-gigabyte", + "unit_length": "short" + } + } + ] + } + ] + }, + "type": "Calculated", + "warning": "These answers must add up to the total internet usage", + "calculations": [ + { + "calculation_type": "sum", + "value": { + "identifier": "grand-calculated-summary-4", + "source": "grand_calculated_summary" + }, + "answers_to_calculate": ["internet-pc", "internet-phone"], + "conditions": ["equals"] + } + ], + "answers": [ + { + "id": "internet-pc", + "label": "Amount of internet usage via PC", + "mandatory": true, + "type": "Unit", + "unit_length": "short", + "unit": "digital-gigabyte", + "decimal_places": 2 + }, + { + "id": "internet-phone", + "label": "Amount of internet usage via Phone", + "mandatory": true, + "type": "Unit", + "unit_length": "short", + "unit": "digital-gigabyte", + "decimal_places": 2 + } + ] + } + } + ] + } + ] + }, + { + "id": "section-7", + "title": "Personal Expenditure", + "enabled": { + "when": { + "==": [ + "COMPLETED", + { + "source": "progress", + "selector": "section", + "identifier": "section-6" + } + ] + } + }, + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "id": "group-8", + "blocks": [ + { + "type": "Question", + "id": "personal-expenditure-block", + "question": { + "id": "personal-expenditure-question", + "title": { + "text": "How much of the {total_expenditure} household expenditure do you contribute personally?", + "placeholders": [ + { + "placeholder": "total_expenditure", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "identifier": "grand-calculated-summary-5", + "source": "grand_calculated_summary" + } + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "personal-expenditure-answer", + "label": "Personal contribution", + "mandatory": true, + "description": "Cannot exceed the total expenditure from section 6", + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "maximum": { + "value": { + "identifier": "grand-calculated-summary-5", + "source": "grand_calculated_summary" + } + } + } + ] + } + }, + { + "type": "Interstitial", + "id": "grand-calculated-summary-piping", + "content": { + "title": "You have provided the following information about household expenditure and internet use.", + "contents": [ + { + "list": [ + { + "text": "Total household expenditure: {total_expenditure}", + "placeholders": [ + { + "placeholder": "total_expenditure", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "identifier": "grand-calculated-summary-5", + "source": "grand_calculated_summary" + } + } + } + ] + } + ] + }, + { + "text": "Personal contribution: {personal_contribution}", + "placeholders": [ + { + "placeholder": "personal_contribution", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "identifier": "personal-expenditure-answer", + "source": "answers" + } + } + } + ] + } + ] + }, + { + "text": "Total internet usage: {internet_usage}", + "placeholders": [ + { + "placeholder": "internet_usage", + "transforms": [ + { + "transform": "format_unit", + "arguments": { + "value": { + "source": "grand_calculated_summary", + "identifier": "grand-calculated-summary-4" + }, + "unit": "digital-gigabyte", + "unit_length": "short" + } + } + ] + } + ] + }, + { + "text": "Usage by phone: {internet_phone}", + "placeholders": [ + { + "placeholder": "internet_phone", + "transforms": [ + { + "transform": "format_unit", + "arguments": { + "value": { + "source": "answers", + "identifier": "internet-phone" + }, + "unit": "digital-gigabyte", + "unit_length": "short" + } + } + ] + } + ] + }, + { + "text": "Usage by PC: {internet_pc}", + "placeholders": [ + { + "placeholder": "internet_pc", + "transforms": [ + { + "transform": "format_unit", + "arguments": { + "value": { + "source": "answers", + "identifier": "internet-pc" + }, + "unit": "digital-gigabyte", + "unit_length": "short" + } + } + ] + } + ] + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_hub_and_spoke.json b/schemas/test/en/test_hub_and_spoke.json new file mode 100644 index 0000000000..7535553170 --- /dev/null +++ b/schemas/test/en/test_hub_and_spoke.json @@ -0,0 +1,319 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Hub & Spoke", + "theme": "default", + "description": "A questionnaire to demo hub and spoke functionality", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "employment-section", + "title": "Employment", + "groups": [ + { + "id": "radio", + "title": "Radio Optional", + "blocks": [ + { + "type": "Question", + "id": "employment-status", + "question": { + "answers": [ + { + "id": "employment-status-answer", + "mandatory": false, + "options": [ + { + "label": "Working as an employee", + "value": "Working as an employee" + }, + { + "label": "Self-employed or freelance", + "value": "Self-employed or freelance" + }, + { + "label": "Temporarily away from work ill, on holiday or temporarily laid off", + "value": "Temporarily away from work ill, on holiday or temporarily laid off" + }, + { + "label": "On maternity or paternity leave", + "value": "On maternity or paternity leave" + }, + { + "label": "Doing any other kind of paid work", + "value": "Doing any other kind of paid work" + } + ], + "type": "Checkbox" + }, + { + "id": "employment-status-answer-exclusive", + "mandatory": false, + "options": [ + { + "label": "None of these apply", + "value": "None of these apply" + } + ], + "type": "Checkbox" + } + ], + "guidance": { + "contents": [ + { + "description": "Include casual or temporary work, even if only for one hour" + } + ] + }, + "id": "employment-status-question", + "mandatory": true, + "title": "In the last seven days, were you doing any of the following?", + "type": "MutuallyExclusive" + }, + "routing_rules": [ + { + "group": "checkboxes", + "when": { + "!=": [ + { + "identifier": "employment-status-answer", + "source": "answers" + }, + null + ] + } + }, + { + "block": "employment-type" + } + ] + }, + { + "type": "Question", + "id": "employment-type", + "question": { + "answers": [ + { + "id": "employment-type-answer", + "mandatory": false, + "options": [ + { + "description": "Whether receiving a pension or not", + "label": "Retired", + "value": "Retired" + }, + { + "label": "Studying", + "value": "Studying" + }, + { + "label": "Looking after home or family", + "value": "Looking after home or family" + }, + { + "label": "Long-term sick or disabled", + "value": "Long-term sick or disabled" + }, + { + "label": "Other", + "value": "Other" + } + ], + "type": "Checkbox" + } + ], + "id": "employment-type-question", + "title": "Which of the following describes what you were doing in the last seven days?", + "type": "General" + } + } + ] + } + ] + }, + { + "id": "accommodation-section", + "title": "Accommodation", + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "blocks": [ + { + "id": "proxy", + "question": { + "answers": [ + { + "default": "Yes", + "id": "proxy-answer", + "mandatory": false, + "options": [ + { + "label": "No, I’m answering for myself", + "value": "No, I’m answering for myself" + }, + { + "label": "Yes", + "value": "Yes" + } + ], + "type": "Radio" + } + ], + "id": "proxy-question", + "title": "Are you answering the questions on behalf of someone else?", + "type": "General" + }, + "type": "Question" + } + ], + "id": "checkboxes" + } + ] + }, + { + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "blocks": [ + { + "id": "does-anyone-live-here", + "question": { + "answers": [ + { + "id": "does-anyone-live-here-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "does-anyone-live-here-question", + "title": "Does anyone live here?", + "type": "General" + }, + "type": "Question" + }, + { + "id": "how-many-people-live-here", + "question": { + "answers": [ + { + "id": "how-many-people-live-here-answer", + "mandatory": true, + "options": [ + { + "label": "1", + "value": "1" + }, + { + "label": "2", + "value": "2" + }, + { + "label": "3+", + "value": "3+" + } + ], + "type": "Radio" + } + ], + "id": "how-many-people-live-here-question", + "title": "How many people live here?", + "type": "General" + }, + "type": "Question", + "skip_conditions": { + "when": { + "==": [ + { + "source": "answers", + "identifier": "does-anyone-live-here-answer" + }, + "No" + ] + } + } + } + ], + "id": "household-question-group", + "title": "Household residents" + } + ], + "id": "household-section", + "title": "Household residents" + }, + { + "id": "relationships-section", + "title": "Relationships", + "show_on_hub": false, + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "blocks": [ + { + "id": "anyone-related", + "question": { + "answers": [ + { + "id": "anyone-related-answer", + "mandatory": false, + "options": [ + { + "label": "No", + "value": "No" + }, + { + "label": "Yes", + "value": "Yes" + } + ], + "type": "Radio" + } + ], + "id": "anyone-related-question", + "title": "Are any of the people living here related?", + "type": "General" + }, + "type": "Question" + } + ], + "id": "relationship-group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_hub_and_spoke_custom_content.json b/schemas/test/en/test_hub_and_spoke_custom_content.json new file mode 100644 index 0000000000..b951e23cba --- /dev/null +++ b/schemas/test/en/test_hub_and_spoke_custom_content.json @@ -0,0 +1,118 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Hub & Spoke", + "theme": "default", + "description": "A questionnaire to demo hub and spoke custom content functionality", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "submission": { + "button": "Submission button", + "guidance": "Submission guidance", + "title": "Submission title", + "warning": "Submission warning" + }, + "sections": [ + { + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "blocks": [ + { + "id": "does-anyone-live-here", + "question": { + "answers": [ + { + "id": "does-anyone-live-here-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "does-anyone-live-here-question", + "title": "Does anyone live here?", + "type": "General" + }, + "type": "Question" + }, + { + "id": "how-many-people-live-here", + "question": { + "answers": [ + { + "id": "how-many-people-live-here-answer", + "mandatory": true, + "options": [ + { + "label": "1", + "value": "1" + }, + { + "label": "2", + "value": "2" + }, + { + "label": "3+", + "value": "3+" + } + ], + "type": "Radio" + } + ], + "id": "how-many-people-live-here-question", + "title": "How many people live here?", + "type": "General" + }, + "type": "Question", + "skip_conditions": { + "when": { + "==": [ + { + "source": "answers", + "identifier": "does-anyone-live-here-answer" + }, + "No" + ] + } + } + } + ], + "id": "household-question-group", + "title": "Household residents" + } + ], + "id": "household-section", + "title": "Household residents" + } + ] +} diff --git a/schemas/test/en/test_hub_complete_sections.json b/schemas/test/en/test_hub_complete_sections.json new file mode 100644 index 0000000000..e0691427e9 --- /dev/null +++ b/schemas/test/en/test_hub_complete_sections.json @@ -0,0 +1,198 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Hub & Spoke", + "theme": "default", + "description": "A questionnaire to demo hub and spoke functionality", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { + "required_completed_sections": ["employment-section"] + } + }, + "sections": [ + { + "id": "employment-section", + "title": "Employment", + "groups": [ + { + "id": "radio", + "title": "Radio Optional", + "blocks": [ + { + "type": "Question", + "id": "employment-status", + "question": { + "answers": [ + { + "id": "employment-status-answer", + "mandatory": false, + "options": [ + { + "label": "Working as an employee", + "value": "Working as an employee" + }, + { + "label": "Self-employed or freelance", + "value": "Self-employed or freelance" + }, + { + "label": "Temporarily away from work ill, on holiday or temporarily laid off", + "value": "Temporarily away from work ill, on holiday or temporarily laid off" + }, + { + "label": "On maternity or paternity leave", + "value": "On maternity or paternity leave" + }, + { + "label": "Doing any other kind of paid work", + "value": "Doing any other kind of paid work" + } + ], + "type": "Checkbox" + }, + { + "id": "employment-status-answer-exclusive", + "mandatory": false, + "options": [ + { + "label": "None of these apply", + "value": "None of these apply" + } + ], + "type": "Checkbox" + } + ], + "guidance": { + "contents": [ + { + "description": "Include casual or temporary work, even if only for one hour" + } + ] + }, + "id": "employment-status-question", + "mandatory": true, + "title": "In the last seven days, were you doing any of the following?", + "type": "MutuallyExclusive" + }, + "routing_rules": [ + { + "group": "checkboxes", + "when": { + "!=": [ + { + "identifier": "employment-status-answer", + "source": "answers" + }, + null + ] + } + }, + { + "block": "employment-type" + } + ] + }, + { + "type": "Question", + "id": "employment-type", + "question": { + "answers": [ + { + "id": "employment-type-answer", + "mandatory": false, + "options": [ + { + "description": "Whether receiving a pension or not", + "label": "Retired", + "value": "Retired" + }, + { + "label": "Studying", + "value": "Studying" + }, + { + "label": "Looking after home or family", + "value": "Looking after home or family" + }, + { + "label": "Long-term sick or disabled", + "value": "Long-term sick or disabled" + }, + { + "label": "Other", + "value": "Other" + } + ], + "type": "Checkbox" + } + ], + "id": "employment-type-question", + "title": "Which of the following describes what you were doing in the last seven days?", + "type": "General" + } + } + ] + } + ] + }, + { + "id": "accommodation-section", + "title": "Accommodation", + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "blocks": [ + { + "id": "proxy", + "question": { + "answers": [ + { + "default": "Yes", + "id": "proxy-answer", + "mandatory": false, + "options": [ + { + "label": "No, I’m answering for myself", + "value": "No, I’m answering for myself" + }, + { + "label": "Yes", + "value": "Yes" + } + ], + "type": "Radio" + } + ], + "id": "proxy-question", + "title": "Are you answering the questions on behalf of someone else?", + "type": "General" + }, + "type": "Question" + } + ], + "id": "checkboxes" + } + ] + } + ] +} diff --git a/schemas/test/en/test_hub_section_required_and_enabled.json b/schemas/test/en/test_hub_section_required_and_enabled.json new file mode 100644 index 0000000000..6320062ce6 --- /dev/null +++ b/schemas/test/en/test_hub_section_required_and_enabled.json @@ -0,0 +1,122 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Hub & Spoke required and enabled sections", + "theme": "default", + "description": "A questionnaire to demo hub and spoke required and enabled sections", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { "required_completed_sections": ["household-section", "relationships-section"] } + }, + "sections": [ + { + "id": "household-section", + "title": "Household", + "groups": [ + { + "id": "radio", + "title": "Household Relationships", + "blocks": [ + { + "type": "Question", + "id": "household-relationships-block", + "question": { + "type": "General", + "id": "household-relationships-question", + "title": "Is anyone related in this household?", + "answers": [ + { + "type": "Radio", + "id": "household-relationships-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "relationships-section", + "title": "Relationships", + "show_on_hub": false, + "groups": [ + { + "blocks": [ + { + "id": "relationships-count", + "question": { + "type": "General", + "id": "relationships-count-question", + "title": "How many people are related?", + "answers": [ + { + "type": "Radio", + "id": "relationships-count-answer", + "mandatory": true, + "options": [ + { + "label": "1", + "value": "1" + }, + { + "label": "2", + "value": "2" + }, + { + "label": "3+", + "value": "3+" + } + ] + } + ] + }, + "type": "Question" + } + ], + "id": "relationships-count-group", + "title": "Relationships count" + } + ], + "enabled": { + "when": { + "==": [ + "Yes", + { + "source": "answers", + "identifier": "household-relationships-answer" + } + ] + } + } + } + ] +} diff --git a/schemas/test/en/test_hub_section_required_with_repeat.json b/schemas/test/en/test_hub_section_required_with_repeat.json new file mode 100644 index 0000000000..aaff2a9ed3 --- /dev/null +++ b/schemas/test/en/test_hub_section_required_with_repeat.json @@ -0,0 +1,431 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Hub & Spoke Enabled with Required Repeating Sections", + "theme": "default", + "description": "A questionnaire to demo hub and spoke functionality with required repeating sections", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { + "required_completed_sections": ["list-collector-section", "personal-details-section"] + } + }, + "sections": [ + { + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": "Household members", + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ] + }, + "id": "list-collector-section", + "title": "Household", + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "primary-person-list-collector", + "type": "PrimaryPersonListCollector", + "for_list": "people", + "add_or_edit_block": { + "id": "add-or-edit-primary-person", + "type": "PrimaryPersonListAddOrEditQuestion", + "question": { + "id": "primary-person-add-or-edit-question", + "type": "General", + "title": "What is your name?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "question": { + "id": "primary-confirmation-question", + "type": "General", + "title": "Do you live here?", + "answers": [ + { + "id": "you-live-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "personal-details-section", + "title": "Personal Details", + "summary": { + "show_on_completion": true + }, + "repeat": { + "for_list": "people", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "groups": [ + { + "id": "personal-details-group", + "title": "Personal Details", + "blocks": [ + { + "id": "proxy", + "question": { + "answers": [ + { + "default": "Yes", + "id": "proxy-answer", + "mandatory": false, + "options": [ + { + "label": "No, I’m answering for myself", + "value": "No, I’m answering for myself" + }, + { + "label": "Yes", + "value": "Yes" + } + ], + "type": "Radio" + } + ], + "id": "proxy-question", + "title": "Are you answering the questions on behalf of someone else?", + "type": "General" + }, + "type": "Question" + }, + { + "id": "date-of-birth", + "question_variants": [ + { + "question": { + "answers": [ + { + "id": "date-of-birth-answer", + "mandatory": true, + "maximum": { + "value": "now" + }, + "minimum": { + "offset_by": { + "years": -115 + }, + "value": "2019-10-13" + }, + "type": "Date" + } + ], + "guidance": { + "contents": [ + { + "description": "For example 31 12 1970" + } + ] + }, + "id": "date-of-birth-question", + "title": "What is your date of birth?", + "type": "General" + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "proxy-answer" + }, + "No, I’m answering for myself" + ] + } + }, + { + "question": { + "answers": [ + { + "id": "date-of-birth-answer", + "mandatory": true, + "maximum": { + "value": "now" + }, + "minimum": { + "offset_by": { + "years": -115 + }, + "value": "2019-10-13" + }, + "type": "Date" + } + ], + "guidance": { + "contents": [ + { + "description": "For example 31 12 1970" + } + ] + }, + "id": "date-of-birth-question", + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "What is {person_name_possessive} date of birth?" + }, + "type": "General" + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "proxy-answer" + }, + "Yes" + ] + } + } + ], + "type": "Question" + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_hub_section_required_with_repeat_supplementary.json b/schemas/test/en/test_hub_section_required_with_repeat_supplementary.json new file mode 100644 index 0000000000..a61369a87a --- /dev/null +++ b/schemas/test/en/test_hub_section_required_with_repeat_supplementary.json @@ -0,0 +1,414 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "123", + "title": "Test Hub Enabled with Repeats Using Supplementary Data", + "theme": "default", + "description": "A questionnaire to demo the Hub enabled when repeating sections using Supplementary data are complete.", + "metadata": [ + { + "name": "survey_id", + "type": "string" + }, + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "sds_dataset_id", + "type": "string" + } + ], + "supplementary_data": { + "lists": ["employees"] + }, + "questionnaire_flow": { + "type": "Hub", + "options": { + "required_completed_sections": ["introduction-section", "section-2", "section-3"] + } + }, + "post_submission": { + "view_response": true + }, + "sections": [ + { + "id": "introduction-section", + "title": "Introduction", + "groups": [ + { + "id": "introduction-group", + "title": "Introduction Group", + "blocks": [ + { + "id": "loaded-successfully-block", + "type": "Interstitial", + "content": { + "title": "Supplementary Data", + "contents": [ + { + "title": "You have successfully loaded Supplementary data", + "description": "Press continue to proceed to the introduction", + "guidance": { + "contents": [ + { + "description": "The purpose of this block, is to test that supplementary data loads successfully, separate to using the supplementary data" + } + ] + } + } + ] + } + }, + { + "id": "introduction-block", + "type": "Introduction", + "primary_content": [ + { + "id": "business-details", + "title": { + "text": "You are completing this survey for {company_name}", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "supplementary_data", + "identifier": "company_name" + } + } + ] + }, + "contents": [ + { + "description": { + "text": "If the company details or structure have changed contact us on {telephone_number_link}", + "placeholders": [ + { + "placeholder": "telephone_number_link", + "value": { + "source": "supplementary_data", + "identifier": "company_details", + "selectors": ["telephone_number"] + } + } + ] + } + }, + { + "guidance": { + "contents": [ + { + "title": "Guidance for completing this survey", + "list": [ + "The company name, telephone number all come from supplementary data", + "if you picked the supplementary dataset with guidance, there will be a 3rd bullet point below this one, with the supplementary guidance.", + { + "text": "{survey_guidance}", + "placeholders": [ + { + "placeholder": "survey_guidance", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "supplementary_data", + "identifier": "guidance" + } + ] + } + } + ] + } + ] + } + ] + } + ] + } + } + ] + } + ] + } + ] + } + ] + }, + { + "id": "section-2", + "title": "Employees", + "groups": [ + { + "id": "employee-reporting", + "blocks": [ + { + "id": "list-collector-employees", + "type": "ListCollectorContent", + "page_title": "Employees", + "for_list": "employees", + "content": { + "title": "Employees", + "contents": [ + { + "definition": { + "title": "Company employees", + "contents": [ + { + "description": "List of previously reported employees." + } + ] + } + }, + { + "description": "You have previously reported on the above employees. Press continue to proceed to the next section where you can add any additional employees." + } + ] + }, + "summary": { + "title": "employees", + "item_title": { + "text": "{employee_name}", + "placeholders": [ + { + "placeholder": "employee_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "supplementary_data", + "identifier": "employees", + "selectors": ["personal_details", "forename"] + }, + { + "source": "supplementary_data", + "identifier": "employees", + "selectors": ["personal_details", "surname"] + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "section-3", + "title": "Employee Details", + "summary": { + "show_on_completion": true + }, + "repeat": { + "for_list": "employees", + "title": { + "text": "{employee_name}", + "placeholders": [ + { + "placeholder": "employee_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "supplementary_data", + "identifier": "employees", + "selectors": ["personal_details", "forename"] + }, + { + "source": "supplementary_data", + "identifier": "employees", + "selectors": ["personal_details", "surname"] + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + }, + "groups": [ + { + "id": "employee-detail-questions", + "blocks": [ + { + "type": "Question", + "id": "length-of-employment", + "question": { + "id": "length-employment-question", + "type": "General", + "title": { + "text": "When did {employee_name} start working for {company_name}?", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "supplementary_data", + "identifier": "company_name" + } + }, + { + "placeholder": "employee_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "supplementary_data", + "identifier": "employees", + "selectors": ["personal_details", "forename"] + }, + { + "source": "supplementary_data", + "identifier": "employees", + "selectors": ["personal_details", "surname"] + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + }, + "answers": [ + { + "id": "employment-start", + "label": { + "text": "Start date at {company_name}", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "supplementary_data", + "identifier": "company_name" + } + } + ] + }, + "mandatory": true, + "type": "Date", + "maximum": { + "value": "now" + }, + "minimum": { + "value": { + "source": "supplementary_data", + "identifier": "incorporation_date" + } + } + } + ] + } + }, + { + "id": "conditional-employee-block", + "type": "Question", + "skip_conditions": { + "when": { + "!=": [ + { + "count": [ + { + "source": "list", + "identifier": "employees" + } + ] + }, + 3 + ] + } + }, + "question": { + "id": "conditional-employee-question", + "guidance": { + "contents": [ + { + "description": "This block is enabled because there are 3 employees in the supplementary dataset" + } + ] + }, + "type": "General", + "title": { + "text": "Has {employee_name} been promoted since starting at {company_name}?", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "supplementary_data", + "identifier": "company_name" + } + }, + { + "placeholder": "employee_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "supplementary_data", + "identifier": "employees", + "selectors": ["personal_details", "forename"] + }, + { + "source": "supplementary_data", + "identifier": "employees", + "selectors": ["personal_details", "surname"] + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + }, + "answers": [ + { + "id": "promoted-yes-no-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_individual_response.json b/schemas/test/en/test_individual_response.json new file mode 100644 index 0000000000..447c3b0915 --- /dev/null +++ b/schemas/test/en/test_individual_response.json @@ -0,0 +1,626 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "census", + "title": "Test Individual Response", + "theme": "default", + "description": "A questionnaire to test individual response", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "display_address", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { "required_completed_sections": ["section"] } + }, + "individual_response": { + "for_list": "household", + "individual_section_id": "individual-section" + }, + "sections": [ + { + "id": "section", + "title": "People who live here", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "household", + "title": { + "text": "Household members staying overnight on {census_date}", + "placeholders": [ + { + "placeholder": "census_date", + "transforms": [ + { + "arguments": { + "date_format": "d MMMM yyyy", + "date_to_format": { + "value": "2019-10-13" + } + }, + "transform": "format_date" + } + ] + } + ] + }, + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "Questions", + "blocks": [ + { + "id": "primary-person-list-collector", + "type": "PrimaryPersonListCollector", + "for_list": "household", + "same_name_answer_ids": ["first-name", "last-name"], + "add_or_edit_block": { + "id": "add-or-edit-primary-person", + "type": "PrimaryPersonListAddOrEditQuestion", + "question": { + "id": "primary-person-add-or-edit-question", + "type": "General", + "title": "What is your name?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "middle-names", + "label": "Middle names", + "mandatory": false, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "question": { + "id": "primary-confirmation-question", + "type": "General", + "title": "Do you live here?", + "answers": [ + { + "id": "you-live-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "household", + "same_name_answer_ids": ["first-name", "last-name"], + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "middle-names", + "label": "Middle names", + "mandatory": false, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "middle-names", + "label": "Middle names", + "mandatory": false, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": { + "text": "Household members staying overnight on {census_date}", + "placeholders": [ + { + "placeholder": "census_date", + "transforms": [ + { + "arguments": { + "date_format": "d MMMM yyyy", + "date_to_format": { + "value": "2019-10-13" + } + }, + "transform": "format_date" + } + ] + } + ] + }, + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "id": "visitor-list-collector", + "type": "ListCollector", + "for_list": "visitor", + "question": { + "id": "visitor-question", + "type": "General", + "title": "Any visitors?", + "answers": [ + { + "id": "any-visitors", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-visitor", + "type": "ListAddQuestion", + "question": { + "id": "visitor-add-person", + "type": "General", + "title": "What is the name of the visitor?", + "answers": [ + { + "id": "visitor-first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "visitor-middle-names", + "label": "Middle names", + "mandatory": false, + "type": "TextField" + }, + { + "id": "visitor-last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "visitor-edit-person", + "type": "ListEditQuestion", + "question": { + "id": "visitor-edit-question", + "type": "General", + "title": "What is the name of the visitor?", + "answers": [ + { + "id": "visitor-first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "visitor-middle-names", + "label": "Middle names", + "mandatory": false, + "type": "TextField" + }, + { + "id": "visitor-last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "visitor-remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "visitor-remove-question", + "type": "General", + "title": "Are you sure you want to remove this visitor?", + "answers": [ + { + "id": "visitor-remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Visitors", + "item_title": { + "text": "{visitor_name}", + "placeholders": [ + { + "placeholder": "visitor_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "visitor-first-name" + }, + { + "source": "answers", + "identifier": "visitor-last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "groups": [ + { + "blocks": [ + { + "content": { + "contents": [ + { + "description": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ], + "text": "In this section, we are going to ask you questions about {person_name}." + } + }, + { + "list": ["date of birth"], + "title": "You will need to know personal details such as" + } + ], + "title": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ], + "text": "{person_name}" + } + }, + "id": "individual-interstitial", + "type": "Interstitial" + }, + { + "content": { + "contents": [ + { + "description": "Another interstitial page to ensure that the individual response guidance is only displayed for the first block in the individual section." + } + ], + "title": "Another interstitial" + }, + "id": "another-interstitial", + "page_title": "Another interstitial", + "type": "Interstitial" + }, + { + "id": "proxy", + "question": { + "answers": [ + { + "default": "No, I am answering on their behalf", + "id": "proxy-answer", + "mandatory": false, + "options": [ + { + "label": "Yes, I am", + "value": "Yes, I am" + }, + { + "label": "No, I am answering on their behalf", + "value": "No, I am answering on their behalf" + } + ], + "type": "Radio" + } + ], + "id": "proxy-question", + "title": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ], + "text": "Are you {person_name}?" + }, + "type": "General" + }, + "type": "Question" + } + ], + "id": "personal-details-group", + "title": "Personal Details" + } + ], + "id": "individual-section", + "repeat": { + "for_list": "household", + "title": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ], + "text": "{person_name}" + } + }, + "summary": { + "show_on_completion": false + }, + "title": "Individual Section" + } + ] +} diff --git a/schemas/test/en/test_individual_response_on_hub_disabled.json b/schemas/test/en/test_individual_response_on_hub_disabled.json new file mode 100644 index 0000000000..8e64f1967b --- /dev/null +++ b/schemas/test/en/test_individual_response_on_hub_disabled.json @@ -0,0 +1,448 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "census", + "title": "Test Individual Response", + "theme": "default", + "description": "A questionnaire to test individual response", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "display_address", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { "required_completed_sections": ["section"] } + }, + "individual_response": { + "show_on_hub": false, + "for_list": "household", + "individual_section_id": "individual-section" + }, + "sections": [ + { + "id": "section", + "title": "People who live here", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "household", + "title": { + "text": "Household members staying overnight on {census_date}", + "placeholders": [ + { + "placeholder": "census_date", + "transforms": [ + { + "arguments": { + "date_format": "d MMMM yyyy", + "date_to_format": { + "value": "2019-10-13" + } + }, + "transform": "format_date" + } + ] + } + ] + }, + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "Questions", + "blocks": [ + { + "id": "primary-person-list-collector", + "type": "PrimaryPersonListCollector", + "for_list": "household", + "add_or_edit_block": { + "id": "add-or-edit-primary-person", + "type": "PrimaryPersonListAddOrEditQuestion", + "question": { + "id": "primary-person-add-or-edit-question", + "type": "General", + "title": "What is your name?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "question": { + "id": "primary-confirmation-question", + "type": "General", + "title": "Do you live here?", + "answers": [ + { + "id": "you-live-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "household", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": { + "text": "Household members staying overnight on {census_date}", + "placeholders": [ + { + "placeholder": "census_date", + "transforms": [ + { + "arguments": { + "date_format": "d MMMM yyyy", + "date_to_format": { + "value": "2019-10-13" + } + }, + "transform": "format_date" + } + ] + } + ] + }, + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "groups": [ + { + "blocks": [ + { + "content": { + "contents": [ + { + "description": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ], + "text": "In this section, we are going to ask you questions about {person_name}." + } + }, + { + "list": ["date of birth"], + "title": "You will need to know personal details such as" + } + ], + "title": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ], + "text": "{person_name}" + } + }, + "id": "individual-interstitial", + "type": "Interstitial" + }, + { + "id": "proxy", + "question": { + "answers": [ + { + "default": "No, I am answering on their behalf", + "id": "proxy-answer", + "mandatory": false, + "options": [ + { + "label": "Yes, I am", + "value": "Yes, I am" + }, + { + "label": "No, I am answering on their behalf", + "value": "No, I am answering on their behalf" + } + ], + "type": "Radio" + } + ], + "id": "proxy-question", + "title": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ], + "text": "Are you {person_name}?" + }, + "type": "General" + }, + "type": "Question" + } + ], + "id": "personal-details-group", + "title": "Personal Details" + } + ], + "id": "individual-section", + "repeat": { + "for_list": "household", + "title": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ], + "text": "{person_name}" + } + }, + "summary": { + "show_on_completion": false + }, + "title": "Individual Section" + } + ] +} diff --git a/schemas/test/en/test_instructions.json b/schemas/test/en/test_instructions.json new file mode 100644 index 0000000000..d80841ce84 --- /dev/null +++ b/schemas/test/en/test_instructions.json @@ -0,0 +1,81 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Interstitial Pages", + "theme": "default", + "description": "A questionnaire to demo interstitial pages.", + "messages": { + "NUMBER_TOO_LARGE": "Number is too large", + "NUMBER_TOO_SMALL": "Number cannot be less than zero", + "INVALID_NUMBER": "Please enter an integer" + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": {} + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Introduction", + "id": "introduction" + }, + { + "id": "interstitial", + "content": { + "title": "Breakfast interstitial", + "instruction": ["Just pause for a second"], + "contents": [ + { + "description": "Next we want to know about your lunch." + } + ] + }, + "type": "Interstitial" + }, + { + "type": "Question", + "id": "lunch-block", + "question": { + "instruction": ["Tell us about what you eat"], + "answers": [ + { + "id": "favourite-lunch", + "label": "What is your favourite lunchtime food", + "mandatory": false, + "type": "TextField" + } + ], + "id": "favourite-lunch-question", + "title": "Title", + "type": "General" + } + } + ], + "id": "favourite-foods", + "title": "Favourite food" + } + ] + } + ] +} diff --git a/schemas/test/en/test_interstitial_definition.json b/schemas/test/en/test_interstitial_definition.json new file mode 100644 index 0000000000..27ae0408ee --- /dev/null +++ b/schemas/test/en/test_interstitial_definition.json @@ -0,0 +1,170 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Interstitial definition", + "theme": "default", + "description": "A questionnaire to demo a definition in an interstitial page.", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "interstitial-section", + "groups": [ + { + "blocks": [ + { + "id": "interstitial-definition", + "content": { + "title": "Interstitial Definition", + "contents": [ + { + "description": "You have successfully launched the test_interstitial_definition questionnaire" + }, + { + "definition": { + "title": "Successfully", + "contents": [ + { + "description": "In a way that accomplishes a desired aim or result" + } + ] + } + }, + { + "description": "You can now continue." + } + ] + }, + "type": "Interstitial" + }, + { + "type": "Question", + "id": "content-variant-definition", + "question": { + "answers": [ + { + "id": "content-variant-definition-answer", + "mandatory": true, + "options": [ + { + "label": "Answer", + "value": "Answer" + }, + { + "label": "Question", + "value": "Question" + } + ], + "type": "Radio" + } + ], + "id": "content-variant-definition-question", + "type": "General", + "title": "What would you like to see a definition about?" + } + }, + { + "type": "Interstitial", + "id": "interstitial-content-variant-definition", + "content_variants": [ + { + "content": { + "title": "Content variant definition", + "contents": [ + { + "description": "According to your response you wanted to see a definition about an answer" + }, + { + "definition": { + "title": "According", + "contents": [ + { + "description": "As stated by or in." + } + ] + } + }, + { + "definition": { + "title": "Answer", + "contents": [ + { + "description": "A spoken or written reply or response to a question" + } + ] + } + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "content-variant-definition-answer" + }, + "Answer" + ] + } + }, + { + "content": { + "title": "Content variant definition", + "contents": [ + { + "description": "According to your response you wanted to see a definition about a question" + }, + { + "definition": { + "title": "Question", + "contents": [ + { + "description": "A sentence worded or expressed so as to elicit information" + } + ] + } + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "content-variant-definition-answer" + }, + "Question" + ] + } + } + ] + } + ], + "id": "interstitial", + "title": "Interstitial Definition" + } + ] + } + ] +} diff --git a/schemas/test/en/test_interstitial_page.json b/schemas/test/en/test_interstitial_page.json new file mode 100644 index 0000000000..18b59c4440 --- /dev/null +++ b/schemas/test/en/test_interstitial_page.json @@ -0,0 +1,96 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Interstitial Pages", + "theme": "default", + "description": "A questionnaire to demo interstitial pages.", + "messages": { + "NUMBER_TOO_LARGE": "Number is too large", + "NUMBER_TOO_SMALL": "Number cannot be less than zero", + "INVALID_NUMBER": "Please enter an integer" + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": {} + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Introduction", + "id": "introduction" + }, + { + "type": "Question", + "id": "breakfast-block", + "question": { + "answers": [ + { + "id": "favourite-breakfast", + "label": "What is your favourite breakfast food", + "mandatory": false, + "type": "TextField" + } + ], + "id": "favourite-breakfast-question", + "title": "What is your favourite breakfast food", + "type": "General" + } + }, + { + "id": "breakfast-interstitial", + "content": { + "title": "Breakfast interstitial", + "contents": [ + { + "description": "You have successfully completed the breakfast section. Next we want to know about your lunch." + } + ] + }, + "type": "Interstitial" + }, + { + "type": "Question", + "id": "lunch-block", + "question": { + "answers": [ + { + "id": "favourite-lunch", + "label": "What is your favourite lunchtime food", + "mandatory": false, + "type": "TextField" + } + ], + "id": "favourite-lunch-question", + "title": "Title", + "type": "General" + } + } + ], + "id": "favourite-foods", + "title": "Favourite food" + } + ] + } + ] +} diff --git a/schemas/test/en/test_interstitial_page_title.json b/schemas/test/en/test_interstitial_page_title.json new file mode 100644 index 0000000000..12f9b9b766 --- /dev/null +++ b/schemas/test/en/test_interstitial_page_title.json @@ -0,0 +1,64 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Interstitial Page Titles", + "theme": "default", + "description": "A questionnaire to demo interstitial pages titles.", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": {} + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "id": "interstitial-page", + "content": { + "title": { + "placeholders": [ + { + "placeholder": "ru_name", + "value": { + "identifier": "ru_name", + "source": "metadata" + } + } + ], + "text": "Your RU name: {ru_name}" + }, + "contents": [ + { + "description": "You have successfully completed the section." + } + ] + }, + "type": "Interstitial" + } + ], + "id": "interstitial-page-titles", + "title": "Interstitial page titles" + } + ] + } + ] +} diff --git a/schemas/test/en/test_interviewer_note.json b/schemas/test/en/test_interviewer_note.json new file mode 100644 index 0000000000..3d67b35043 --- /dev/null +++ b/schemas/test/en/test_interviewer_note.json @@ -0,0 +1,115 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Interviewer Note Pages", + "theme": "default", + "description": "A questionnaire to demo interviewer note highlighting.", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": {} + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "blocks": [ + { + "id": "initial-interstitial-block", + "interviewer_only": true, + "content": { + "title": "Favourite team interstitial", + "contents": [ + { + "description": "In this section we will ask you about your favourite team." + } + ] + }, + "type": "Interstitial" + }, + { + "type": "Question", + "id": "favourite-team-block", + "interviewer_only": true, + "question": { + "answers": [ + { + "id": "favourite-team-answer", + "label": "Favourite team", + "mandatory": false, + "type": "TextField" + } + ], + "id": "favourite-team-question", + "title": "Who is your favourite team?", + "type": "General" + } + }, + { + "type": "Question", + "id": "confirm-block", + "interviewer_only": false, + "question": { + "answers": [ + { + "options": [ + { + "label": "Yes", + "value": "Yes" + } + ], + "id": "confirm-answer", + "mandatory": false, + "type": "Checkbox" + } + ], + "id": "confirm-question", + "title": { + "text": "Can you confirm that {team} is your favourite team?", + "placeholders": [ + { + "placeholder": "team", + "value": { "source": "answers", "identifier": "favourite-team-answer" } + } + ] + }, + "type": "General" + } + }, + { + "id": "final-interstitial-block", + "content": { + "title": "Final interstitial", + "contents": [ + { + "description": "You have successfully completed favourite team section." + } + ] + }, + "type": "Interstitial" + } + ], + "id": "favourite-team", + "title": "Favourite team" + } + ] + } + ] +} diff --git a/schemas/test/en/test_introduction.json b/schemas/test/en/test_introduction.json new file mode 100644 index 0000000000..c2ab5babf1 --- /dev/null +++ b/schemas/test/en/test_introduction.json @@ -0,0 +1,720 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "144", + "theme": "default", + "preview_questions": true, + "title": "Test introduction", + "legal_basis": "Notice is given under section 999 of the Test Act 2000", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "ru_ref", + "type": "string" + }, + { + "name": "trad_as", + "type": "string", + "optional": true + }, + { + "name": "ref_p_start_date", + "type": "date" + }, + { + "name": "ref_p_end_date", + "type": "date" + }, + { + "name": "display_address", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": {} + }, + "sections": [ + { + "id": "introduction-section", + "title": "Main section", + "groups": [ + { + "id": "introduction-group", + "title": "General Business Information", + "blocks": [ + { + "id": "introduction", + "type": "Introduction", + "primary_content": [ + { + "id": "business-details", + "title": { + "text": "You are completing this for {company_name}", + "placeholders": [ + { + "placeholder": "company_name", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "metadata", + "identifier": "trad_as" + }, + { + "source": "metadata", + "identifier": "ru_name" + } + ] + } + } + ] + } + ] + }, + "contents": [ + { + "description": { + "text": "If the company details or structure have changed contact us on {telephone_number_link} or email {email_link}", + "placeholders": [ + { + "placeholder": "telephone_number_link", + "transforms": [ + { + "transform": "telephone_number_link", + "arguments": { + "telephone_number": "0300 1234 931" + } + } + ] + }, + { + "placeholder": "email_link", + "transforms": [ + { + "transform": "email_link", + "arguments": { + "email_address": "surveys@ons.gov.uk", + "email_subject": "Change of details reference", + "email_subject_append": { + "identifier": "ru_ref", + "source": "metadata" + } + } + } + ] + } + ] + } + }, + { + "guidance": { + "contents": [ + { + "title": "Coronavirus (COVID-19) guidance", + "description": "Explain your figures in the comment section to minimise us contacting you and to help us tell an industry story" + } + ] + } + } + ] + }, + { + "id": "use-of-information", + "contents": [ + { + "list": [ + "Data should relate to all sites in England, Scotland and Wales unless otherwise stated.", + "You can provide informed estimates if actual figures aren’t available.", + "We will treat your data securely and confidentially." + ] + }, + { + "description": "To take part, all you need to do is check that you have the information you need to answer the survey questions." + } + ] + } + ], + "preview_content": { + "id": "preview", + "title": "Information you need", + "contents": [ + { + "description": "You can select the dates of the period you are reporting for, if the given dates are not appropriate." + }, + { + "description": "Read the detailed guidance for completing this survey" + } + ], + "questions": [ + { + "id": "employee-pay-frequency", + "question": "Employee pay frequency", + "contents": [ + { + "list": [ + "You will need to indicate how frequently employees are paid i.e weekly, fortnightly, calendar monthly, four weekly or five weekly.", + "You will be asked to answer the questions below for all of your selected pay patterns." + ] + } + ] + }, + { + "id": "what-you-need-to-know", + "question": "What you need to know", + "contents": [ + { + "list": [ + "You can provide informed estimates if actual figures aren’t available", + "All information you provide is strictly confidential" + ] + } + ] + }, + { + "id": "definition-of-innovation", + "question": "Definition of innovation", + "contents": [ + { + "description": { + "text": "Innovation, for the purpose of this survey, is defined as new or significantly improved goods or services as well as processes used to produce or supply all goods or services that {ru_name} has introduced, regardless of their origin.", + "placeholders": [ + { + "placeholder": "ru_name", + "value": { + "source": "metadata", + "identifier": "ru_name" + } + } + ] + } + }, + { + "description": { + "text": "These innovations may be new to {ru_name} or new to the market", + "placeholders": [ + { + "placeholder": "ru_name", + "value": { + "source": "metadata", + "identifier": "ru_name" + } + } + ] + } + }, + { + "description": { + "text": "Investments for future innovation and changes that {ru_name} has introduced at a strategic level (in organisation and practices) are also covered", + "placeholders": [ + { + "placeholder": "ru_name", + "value": { + "source": "metadata", + "identifier": "ru_name" + } + } + ] + } + } + ] + } + ] + }, + "secondary_content": [ + { + "id": "how-we-use-your-data", + "contents": [ + { + "title": "How we use your data", + "list": [ + "You cannot appeal your selection. Your business was selected to give us a comprehensive view of the UK economy", + "The data from you business is essential is it helps us calculate the GDP of the UK", + "Our surveys inform government decisions. For example, past statistics from our surveys led to the introduction of business grants" + ] + } + ] + } + ] + }, + { + "type": "Question", + "id": "report-radio", + "question": { + "guidance": { + "contents": [ + { + "description": "Please provide figures for the period in which you were trading." + } + ] + }, + "description": ["

Your return should relate to the calendar year 2021.

"], + "instruction": ["Select your answer"], + "answers": [ + { + "id": "report-radio-answer", + "mandatory": true, + "description": "Select your answer", + "guidance": { + "show_guidance": "Additional guidance", + "hide_guidance": "Additional guidance", + "contents": [ + { + "description": "For example select `yes` if you can report for this period" + } + ] + }, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ], + "id": "report-radio-question", + "title": { + "text": "Are you able to report for the calendar month {start_date} to {end_date}?", + "placeholders": [ + { + "placeholder": "start_date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "end_date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_end_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General" + } + }, + { + "type": "Question", + "id": "reporting-date", + "question": { + "id": "projects-checkbox-question", + "title": "What dates will you be reporting for?", + "description": [ + "

If figures are not available for the calendar year 2021, your return should relate to a 12 month business year that ends between 6 April 2021 and 5 April 2022.

" + ], + "type": "DateRange", + "answers": [ + { + "id": "answer-from", + "type": "Date", + "mandatory": true, + "label": "Period from", + "minimum": { + "value": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "offset_by": { + "days": -31 + } + } + }, + { + "id": "answer-to", + "type": "Date", + "mandatory": true, + "label": "Period to", + "maximum": { + "value": { + "source": "metadata", + "identifier": "ref_p_end_date" + }, + "offset_by": { + "days": 31 + } + } + } + ], + "guidance": { + "contents": [ + { + "description": "

Only traded for a part of the year?

" + }, + { + "description": "

Please provide figures for the period in which you were trading.

" + }, + { + "description": "

Only commenced trading during 2021?

" + }, + { + "description": "

Your return should cover the period from the commencement of your business until 31 December 2021 or, alternatively, any date up to 5 April 2022.

" + }, + { + "description": "

Ceased trading during 2021?

" + }, + { + "description": "

Your return should cover the period 1 January 2021 to the date you ceased to trade or, alternatively, from the beginning of your last business year up to the cessation date.

" + } + ] + } + } + }, + { + "type": "Question", + "id": "report-radio-second", + "question": { + "description": ["

Your return should relate to the calendar year 2021.

"], + "instruction": ["Select your answer"], + "answers": [ + { + "id": "report-radio-second-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ], + "id": "report-radio-second-question", + "title": { + "text": "Are you sure you are able to report for the calendar month {calendar_start_date} to {calendar_end_date}?", + "placeholders": [ + { + "placeholder": "calendar_start_date", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "identifier": "answer-from", + "source": "answers" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "calendar_end_date", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "identifier": "answer-to", + "source": "answers" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General" + } + }, + { + "type": "Question", + "id": "projects-checkbox", + "question": { + "answers": [ + { + "id": "projects-checkbox-answer", + "instruction": "Select any answers that apply", + "mandatory": true, + "options": [ + { + "label": "Public sector projects", + "value": "Public sector projects", + "description": "This includes public housing and government owned organisations such as local, regional and national public authorities and agencies" + }, + { + "label": "Private sector projects", + "value": "Private sector projects", + "description": "This refers to the part of the economy that is for profit and is owned by private organisations. For example privately owned businesses, housing associations, partnerships and sole traders, joint ventures and privately owned housing" + } + ], + "type": "Checkbox" + } + ], + "id": "projects-checkbox-question-2", + "title": { + "text": "Which sector did {ru_name} carry out work for?", + "placeholders": [ + { + "placeholder": "ru_name", + "value": { + "source": "metadata", + "identifier": "ru_name" + } + } + ] + }, + "type": "General", + "guidance": { + "contents": [ + { + "description": "Include:" + }, + { + "list": ["Local public authorities and agencies", "Regional and national authorities and agencies"] + } + ] + } + } + }, + { + "type": "Question", + "id": "turnover-variants-block", + "question_variants": [ + { + "question": { + "guidance": { + "contents": [ + { + "description": "Include:" + }, + { + "list": [ + "exports", + "payments for work in progress", + "costs incurred and passed on to customers", + "income from sub-contracted activities", + "commission", + "sales of goods purchased for resale", + "revenue earned from other parts of the business not named, please supply at fair value" + ] + }, + { + "description": "Exclude:" + }, + { + "list": [ + "VAT", + "income from the sale of fixed capital assets", + "grants and subsidies", + "insurance claims", + "interest received" + ] + } + ] + }, + "id": "turnover-variants-question", + "title": "What was your total turnover", + "type": "General", + "answers": [ + { + "id": "turnover-variants-answer", + "mandatory": false, + "type": "TextField", + "label": "Total turnover" + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "report-radio-answer" + }, + "Yes" + ] + } + }, + { + "question": { + "id": "turnover-variants-question", + "title": "Why are you not able to report?", + "type": "General", + "answers": [ + { + "id": "turnover-variants-answer", + "mandatory": false, + "type": "TextField", + "label": "Details" + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "report-radio-answer" + }, + "No" + ] + } + } + ] + }, + { + "type": "Question", + "id": "address-mutually-exclusive-checkbox", + "question": { + "id": "address-mutually-exclusive-checkbox-question", + "type": "MutuallyExclusive", + "title": "Were your company based at any of the following addresses?", + "mandatory": true, + "answers": [ + { + "id": "address-checkbox-answer", + "instruction": "Select an answer", + "type": "Checkbox", + "mandatory": false, + "options": [ + { + "label": { + "placeholders": [ + { + "placeholder": "company_address", + "value": { + "identifier": "display_address", + "source": "metadata" + } + } + ], + "text": "{company_address}" + }, + "value": "{company_address}" + }, + { + "label": "7 Evelyn Street, Barry", + "value": "7 Evelyn Street, Barry" + }, + { + "label": "251 Argae Lane, Barry", + "value": "251 Argae Lane, Barry" + } + ] + }, + { + "id": "address-checkbox-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "description": "Some description", + "value": "I prefer not to say" + } + ] + } + ] + } + }, + { + "id": "further-details-text-area", + "type": "Question", + "question": { + "id": "further-details-text-area-question", + "title": "Please provide any further details", + "type": "General", + "description": [ + { + "text": "

Answer for {ru_name}

", + "placeholders": [ + { + "placeholder": "ru_name", + "value": { + "source": "metadata", + "identifier": "ru_name" + } + } + ] + } + ], + "answers": [ + { + "id": "further-details-text-area-answer", + "mandatory": false, + "type": "TextArea", + "label": "Comments", + "max_length": 2000 + } + ] + } + }, + { + "type": "Interstitial", + "id": "general-business-information-completed", + "content": { + "title": "Section complete", + "contents": [ + { + "description": "

You have successfully completed this section

The next section covers changes in business strategy and practices, for example, implementing changes to marketing concepts or strategies.

" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_introduction_hub.json b/schemas/test/en/test_introduction_hub.json new file mode 100644 index 0000000000..d0e761c80c --- /dev/null +++ b/schemas/test/en/test_introduction_hub.json @@ -0,0 +1,636 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "144", + "theme": "default", + "preview_questions": true, + "title": "Test introduction preview questions with hub", + "legal_basis": "Notice is given under section 999 of the Test Act 2000", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "ru_ref", + "type": "string" + }, + { + "name": "trad_as", + "type": "string", + "optional": true + }, + { + "name": "ref_p_start_date", + "type": "date" + }, + { + "name": "ref_p_end_date", + "type": "date" + }, + { + "name": "display_address", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { + "required_completed_sections": ["introduction-section"] + } + }, + "sections": [ + { + "id": "introduction-section", + "title": "Main section", + "summary": { + "page_title": "Summary title", + "show_on_completion": true + }, + "show_on_hub": true, + "groups": [ + { + "id": "introduction-group", + "title": "General Business Information", + "blocks": [ + { + "id": "introduction", + "type": "Introduction", + "primary_content": [ + { + "id": "business-details", + "title": { + "text": "You are completing this for {company_name}", + "placeholders": [ + { + "placeholder": "company_name", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "metadata", + "identifier": "trad_as" + }, + { + "source": "metadata", + "identifier": "ru_name" + } + ] + } + } + ] + } + ] + }, + "contents": [ + { + "description": { + "text": "If the company details or structure have changed contact us on {telephone_number_link} or email {email_link}", + "placeholders": [ + { + "placeholder": "telephone_number_link", + "transforms": [ + { + "transform": "telephone_number_link", + "arguments": { + "telephone_number": "0300 1234 931" + } + } + ] + }, + { + "placeholder": "email_link", + "transforms": [ + { + "transform": "email_link", + "arguments": { + "email_address": "surveys@ons.gov.uk", + "email_subject": "Change of details reference", + "email_subject_append": { + "identifier": "ru_ref", + "source": "metadata" + } + } + } + ] + } + ] + } + }, + { + "guidance": { + "contents": [ + { + "title": "Coronavirus (COVID-19) guidance", + "description": "Explain your figures in the comment section to minimise us contacting you and to help us tell an industry story" + } + ] + } + } + ] + }, + { + "id": "use-of-information", + "contents": [ + { + "list": [ + "Data should relate to all sites in England, Scotland and Wales unless otherwise stated.", + "You can provide informed estimates if actual figures aren’t available.", + "We will treat your data securely and confidentially." + ] + }, + { + "description": "To take part, all you need to do is check that you have the information you need to answer the survey questions." + } + ] + } + ], + "secondary_content": [ + { + "id": "how-we-use-your-data", + "contents": [ + { + "title": "How we use your data", + "list": [ + "You cannot appeal your selection. Your business was selected to give us a comprehensive view of the UK economy", + "The data from you business is essential is it helps us calculate the GDP of the UK", + "Our surveys inform government decisions. For example, past statistics from our surveys led to the introduction of business grants" + ] + } + ] + } + ] + }, + { + "type": "Question", + "id": "report-radio", + "question": { + "guidance": { + "contents": [ + { + "description": "Please provide figures for the period in which you were trading." + } + ] + }, + "description": ["

Your return should relate to the calendar year 2021.

"], + "instruction": ["Select your answer"], + "answers": [ + { + "id": "report-radio-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ], + "id": "report-radio-question", + "title": { + "text": "Are you able to report for the calendar month {start_date} to {end_date}?", + "placeholders": [ + { + "placeholder": "start_date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "end_date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_end_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General" + } + }, + { + "type": "Question", + "id": "reporting-date", + "question": { + "id": "projects-checkbox-question", + "title": "What dates will you be reporting for?", + "description": [ + "

If figures are not available for the calendar year 2021, your return should relate to a 12 month business year that ends between 6 April 2021 and 5 April 2022.

" + ], + "type": "DateRange", + "answers": [ + { + "id": "answer-from", + "type": "Date", + "mandatory": true, + "label": "Period from", + "minimum": { + "value": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "offset_by": { + "days": -31 + } + } + }, + { + "id": "answer-to", + "type": "Date", + "mandatory": true, + "label": "Period to", + "maximum": { + "value": { + "source": "metadata", + "identifier": "ref_p_end_date" + }, + "offset_by": { + "days": 31 + } + } + } + ], + "guidance": { + "contents": [ + { + "description": "

Only traded for a part of the year?

" + }, + { + "description": "

Please provide figures for the period in which you were trading.

" + }, + { + "description": "

Only commenced trading during 2021?

" + }, + { + "description": "

Your return should cover the period from the commencement of your business until 31 December 2021 or, alternatively, any date up to 5 April 2022.

" + }, + { + "description": "

Ceased trading during 2021?

" + }, + { + "description": "

Your return should cover the period 1 January 2021 to the date you ceased to trade or, alternatively, from the beginning of your last business year up to the cessation date.

" + } + ] + } + } + }, + { + "type": "Question", + "id": "report-radio-second", + "question": { + "description": ["

Your return should relate to the calendar year 2021.

"], + "instruction": ["Select your answer"], + "answers": [ + { + "id": "report-radio-second-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ], + "id": "report-radio-second-question", + "title": { + "text": "Are you sure you are able to report for the calendar month {calendar_start_date} to {calendar_end_date}?", + "placeholders": [ + { + "placeholder": "calendar_start_date", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "identifier": "answer-from", + "source": "answers" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "calendar_end_date", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "identifier": "answer-to", + "source": "answers" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General" + } + }, + { + "type": "Question", + "id": "projects-checkbox", + "question": { + "answers": [ + { + "id": "projects-checkbox-answer", + "instruction": "Select any answers that apply", + "mandatory": true, + "options": [ + { + "label": "Public sector projects", + "value": "Public sector projects", + "description": "This includes public housing and government owned organisations such as local, regional and national public authorities and agencies" + }, + { + "label": "Private sector projects", + "value": "Private sector projects", + "description": "This refers to the part of the economy that is for profit and is owned by private organisations. For example privately owned businesses, housing associations, partnerships and sole traders, joint ventures and privately owned housing" + } + ], + "type": "Checkbox" + } + ], + "id": "projects-checkbox-question-2", + "title": { + "text": "Which sector did {ru_name} carry out work for?", + "placeholders": [ + { + "placeholder": "ru_name", + "value": { + "source": "metadata", + "identifier": "ru_name" + } + } + ] + }, + "type": "General", + "guidance": { + "contents": [ + { + "description": "Include:" + }, + { + "list": ["Local public authorities and agencies", "Regional and national authorities and agencies"] + } + ] + } + } + }, + { + "type": "Question", + "id": "turnover-variants-block", + "question_variants": [ + { + "question": { + "guidance": { + "contents": [ + { + "description": "Include:" + }, + { + "list": [ + "exports", + "payments for work in progress", + "costs incurred and passed on to customers", + "income from sub-contracted activities", + "commission", + "sales of goods purchased for resale", + "revenue earned from other parts of the business not named, please supply at fair value" + ] + }, + { + "description": "Exclude:" + }, + { + "list": [ + "VAT", + "income from the sale of fixed capital assets", + "grants and subsidies", + "insurance claims", + "interest received" + ] + } + ] + }, + "id": "turnover-variants-question", + "title": "What was your total turnover", + "type": "General", + "answers": [ + { + "id": "turnover-variants-answer", + "mandatory": false, + "type": "TextField", + "label": "Total turnover" + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "report-radio-answer" + }, + "Yes" + ] + } + }, + { + "question": { + "id": "turnover-variants-question", + "title": "Why are you not able to report?", + "type": "General", + "answers": [ + { + "id": "turnover-variants-answer", + "mandatory": false, + "type": "TextField", + "label": "Details" + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "report-radio-answer" + }, + "No" + ] + } + } + ] + }, + { + "type": "Question", + "id": "address-mutually-exclusive-checkbox", + "question": { + "id": "address-mutually-exclusive-checkbox-question", + "type": "MutuallyExclusive", + "title": "Were your company based at any of the following addresses?", + "mandatory": true, + "answers": [ + { + "id": "address-checkbox-answer", + "instruction": "Select an answer", + "type": "Checkbox", + "mandatory": false, + "options": [ + { + "label": { + "placeholders": [ + { + "placeholder": "company_address", + "value": { + "identifier": "display_address", + "source": "metadata" + } + } + ], + "text": "{company_address}" + }, + "value": "{company_address}" + }, + { + "label": "7 Evelyn Street, Barry", + "value": "7 Evelyn Street, Barry" + }, + { + "label": "251 Argae Lane, Barry", + "value": "251 Argae Lane, Barry" + } + ] + }, + { + "id": "address-checkbox-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "description": "Some description", + "value": "I prefer not to say" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "additional-section", + "title": "Additional section", + "summary": { + "page_title": "Summary title", + "show_on_completion": true + }, + "show_on_hub": true, + "groups": [ + { + "id": "additional-group", + "title": "Additional Business Information", + "blocks": [ + { + "id": "further-details-text-area", + "type": "Question", + "question": { + "id": "further-details-text-area-question", + "title": "Please provide any further details", + "type": "General", + "description": [ + { + "text": "

Answer for {ru_name}

", + "placeholders": [ + { + "placeholder": "ru_name", + "value": { + "source": "metadata", + "identifier": "ru_name" + } + } + ] + } + ], + "answers": [ + { + "id": "further-details-text-area-answer", + "mandatory": false, + "type": "TextArea", + "label": "Comments", + "max_length": 2000 + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_language.json b/schemas/test/en/test_language.json new file mode 100644 index 0000000000..a48c51be0f --- /dev/null +++ b/schemas/test/en/test_language.json @@ -0,0 +1,246 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Language Survey", + "theme": "social", + "description": "A questionnaire to demonstrate language switching", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "submission": { + "button": "Submission button", + "guidance": "Submission guidance", + "title": "Submission title", + "warning": "Submission warning" + }, + "sections": [ + { + "id": "default-section", + "title": "Household details", + "groups": [ + { + "id": "language-group", + "blocks": [ + { + "type": "Question", + "id": "name-block", + "question": { + "instruction": ["Enter the name of a person"], + "description": ["The full name of the person"], + "id": "name-question", + "title": "Please enter a name", + "type": "General", + "answers": [ + { + "id": "first-name", + "label": "First Name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last Name", + "mandatory": false, + "type": "TextField" + } + ] + } + }, + { + "type": "Question", + "id": "dob-block", + "question": { + "description": [ + { + "text": "{person_name_possessive} date of birth", + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ] + } + ], + "id": "dob-question", + "title": { + "text": "What is {person_name_possessive} date of birth?", + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "date-of-birth-answer", + "description": "Enter your date of birth", + "label": "Date of Birth", + "mandatory": true, + "type": "Date" + } + ] + } + }, + { + "type": "Question", + "id": "number-of-people-block", + "question": { + "answers": [ + { + "id": "number-of-people-answer", + "label": "Number of household residents", + "mandatory": true, + "type": "Number", + "minimum": { + "value": 0 + }, + "maximum": { + "value": 100 + } + } + ], + "description": ["The total number of people in the household"], + "warning": "This is a very important question", + "id": "number-of-people-question", + "title": "How many people live at your household?", + "type": "General" + } + }, + { + "type": "Question", + "id": "confirm-number-of-people", + "question": { + "type": "General", + "id": "total-people-question", + "title": { + "text_plural": { + "forms": { + "one": "{number_of_people} person lives here, is this correct?", + "other": "{number_of_people} people live here, is this correct?" + }, + "count": { + "source": "answers", + "identifier": "number-of-people-answer" + } + }, + "placeholders": [ + { + "placeholder": "number_of_people", + "value": { + "source": "answers", + "identifier": "number-of-people-answer" + } + } + ] + }, + "answers": [ + { + "id": "confirm-count", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": { + "text_plural": { + "forms": { + "one": "Yes, {number_of_people} person lives here", + "other": "Yes, {number_of_people} people live here" + }, + "count": { + "source": "answers", + "identifier": "number-of-people-answer" + } + }, + "placeholders": [ + { + "placeholder": "number_of_people", + "value": { + "source": "answers", + "identifier": "number-of-people-answer" + } + } + ] + }, + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_last_viewed_question_guidance.json b/schemas/test/en/test_last_viewed_question_guidance.json new file mode 100644 index 0000000000..7b6b183db1 --- /dev/null +++ b/schemas/test/en/test_last_viewed_question_guidance.json @@ -0,0 +1,976 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test last viewed question guidance", + "theme": "default", + "description": "A questionnaire to test last viewed question guidance on different block types", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": {} + }, + "sections": [ + { + "id": "section", + "title": "Household members", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": "Household members", + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "Household members", + "blocks": [ + { + "id": "household-interstitial", + "content": { + "title": "Household interstitial", + "contents": [ + { + "description": "The following section concerns household members" + } + ] + }, + "type": "Interstitial" + }, + { + "type": "Question", + "id": "address-confirmation", + "question": { + "type": "General", + "id": "address-confirmation-question", + "title": "Is this property 742 Evergreen Terrace?", + "answers": [ + { + "type": "Radio", + "id": "address-confirmation-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "id": "primary-person-list-collector", + "type": "PrimaryPersonListCollector", + "for_list": "people", + "add_or_edit_block": { + "id": "add-or-edit-primary-person", + "type": "PrimaryPersonListAddOrEditQuestion", + "question": { + "id": "primary-person-add-or-edit-question", + "type": "General", + "title": "What is your name", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "question": { + "id": "primary-confirmation-question", + "type": "General", + "title": "Do you live here?", + "answers": [ + { + "id": "you-live-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "id": "anyone-usually-live-at", + "question": { + "answers": [ + { + "id": "anyone-usually-live-at-answer", + "mandatory": true, + "options": [ + { + "action": { + "params": { + "block_id": "add-person", + "list_name": "people" + }, + "type": "RedirectToListAddBlock" + }, + "label": "Yes", + "value": "Yes" + }, + { + "description": "For example, this is a second address or holiday home", + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "anyone-usually-live-at-question", + "title": "Does anyone else live at your address?", + "type": "General" + }, + "routing_rules": [ + { + "section": "End", + "when": { + "and": [ + { + "==": [ + { + "identifier": "anyone-usually-live-at-answer", + "source": "answers" + }, + "No" + ] + }, + { + "<": [ + { + "source": "list", + "identifier": "people", + "selector": "count" + }, + 1 + ] + } + ] + } + }, + { + "block": "list-collector" + } + ], + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "you-live-here", + "source": "answers" + }, + "Yes" + ] + } + }, + "type": "Question" + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": { + "text": "Change details for {first_name} {last_name}", + "placeholders": [ + { + "placeholder": "first_name", + "value": { + "source": "answers", + "identifier": "first-name" + } + }, + { + "placeholder": "last_name", + "value": { + "source": "answers", + "identifier": "last-name" + } + } + ] + }, + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "relationships-section", + "groups": [ + { + "blocks": [ + { + "id": "relationship-interstitial", + "content": { + "title": "relationship interstitial", + "contents": [ + { + "description": "The following section deals with the relationships in your household." + } + ] + }, + "type": "Interstitial" + }, + { + "type": "RelationshipCollector", + "id": "relationships", + "title": "This will iterate over the people list, capturing the one way relationships.", + "for_list": "people", + "question": { + "id": "relationship-question", + "type": "General", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their ", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "answers": [ + { + "id": "relationship-answer", + "mandatory": true, + "type": "Relationship", + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} ", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "options": [ + { + "label": "Husband or Wife", + "value": "Husband or Wife", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their husband or wife", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} husband or wife", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + { + "label": "Son or daughter", + "value": "Son or daughter", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their son or daughter", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} son or daughter", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + { + "label": "Brother or sister", + "value": "Brother or sister", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their brother or sister", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} brother or sister", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "description": "Including half brother or half sister" + } + ] + } + ] + }, + "skip_conditions": { + "when": { + "<": [ + { + "source": "list", + "identifier": "people", + "selector": "count" + }, + 2 + ] + } + } + } + ], + "id": "relationship-group", + "title": "Relationships" + } + ] + } + ] +} diff --git a/schemas/test/en/test_last_viewed_question_guidance_hub.json b/schemas/test/en/test_last_viewed_question_guidance_hub.json new file mode 100644 index 0000000000..cfac66b4b8 --- /dev/null +++ b/schemas/test/en/test_last_viewed_question_guidance_hub.json @@ -0,0 +1,235 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Hub & Spoke Last viewed question guidance", + "theme": "default", + "description": "A questionnaire to demo last viewed question guidance on hub and spoke", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { "required_completed_sections": ["work-section"] } + }, + "sections": [ + { + "id": "work-section", + "title": "Work", + "groups": [ + { + "id": "radio", + "title": "Radio Optional", + "blocks": [ + { + "id": "work-interstitial", + "content": { + "title": "Work interstitial", + "contents": [ + { + "description": "The following section concerns paid and unpaid work" + } + ] + }, + "type": "Interstitial" + }, + { + "type": "Question", + "id": "paid-work", + "question": { + "answers": [ + { + "id": "paid-work-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "paid-work-question", + "title": "In the last seven days, have you done any paid work?", + "type": "General" + } + }, + { + "type": "Question", + "id": "unpaid-work", + "question": { + "answers": [ + { + "id": "unpaid-work-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "unpaid-work-question", + "title": "In the last seven days, have you done any unpaid work?", + "type": "General" + } + } + ] + } + ] + }, + { + "id": "education-section", + "title": "Education", + "summary": { "show_on_completion": true }, + "groups": [ + { + "blocks": [ + { + "id": "gcses", + "question": { + "answers": [ + { + "id": "gcse-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "gcse-question", + "title": "Do you have any GCSEs?", + "type": "General" + }, + "type": "Question" + }, + { + "id": "a-levels", + "question": { + "answers": [ + { + "id": "alevels-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "alevels-question", + "title": "Do you have any A-levels?", + "type": "General" + }, + "type": "Question" + } + ], + "id": "education-group", + "title": "Education" + } + ] + }, + { + "id": "interests-section", + "title": "Interests (no summary)", + "groups": [ + { + "blocks": [ + { + "id": "sports", + "question": { + "answers": [ + { + "id": "sports-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "sports-question", + "title": "Do play any sports?", + "type": "General" + }, + "type": "Question" + }, + { + "id": "hobbies", + "question": { + "answers": [ + { + "id": "hobbies-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "hobbies-question", + "title": "Do you have any hobbies?", + "type": "General" + }, + "type": "Question" + } + ], + "id": "interests-group", + "title": "Interests" + } + ] + } + ] +} diff --git a/schemas/test/en/test_list_change_evaluates_sections.json b/schemas/test/en/test_list_change_evaluates_sections.json new file mode 100644 index 0000000000..fe038d1578 --- /dev/null +++ b/schemas/test/en/test_list_change_evaluates_sections.json @@ -0,0 +1,352 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test ListCollector Evaluate Sections", + "theme": "default", + "description": "A questionnaire to test that changes to a list update section completeness", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": "Household members", + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ] + }, + "id": "who-lives-here", + "title": "Who Lives Here", + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "primary-person-list-collector", + "type": "PrimaryPersonListCollector", + "for_list": "people", + "add_or_edit_block": { + "id": "add-or-edit-primary-person", + "type": "PrimaryPersonListAddOrEditQuestion", + "question": { + "id": "primary-person-add-or-edit-question", + "type": "General", + "title": "What is your name", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "question": { + "id": "primary-confirmation-question", + "type": "General", + "title": "Do you live here?", + "answers": [ + { + "id": "you-live-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "blocks": [ + { + "id": "accommodation-type", + "question": { + "answers": [ + { + "id": "accommodation-type-answer", + "mandatory": false, + "options": [ + { + "label": "Whole house or bungalow", + "value": "Whole house or bungalow" + }, + { + "description": "Including purpose-built flats and flats within converted and shared houses", + "label": "Flat, maisonette or apartment", + "value": "Flat, maisonette or apartment" + } + ], + "type": "Radio" + } + ], + "id": "accommodation-type-question", + "title": "What type of accommodation is your house?", + "type": "General" + }, + "type": "Question" + }, + { + "id": "central-heating", + "question": { + "answers": [ + { + "id": "central-heating-answer", + "mandatory": false, + "options": [ + { + "label": "District or communal heat networks", + "value": "District or communal heat networks" + }, + { + "label": "Other", + "value": "Other" + } + ], + "type": "Checkbox" + } + ], + "id": "central-heating-question", + "title": "What type of central heating does your house have?", + "type": "General" + }, + "routing_rules": [ + { + "section": "End", + "when": { + "==": [ + { + "source": "list", + "identifier": "people", + "selector": "count" + }, + 0 + ] + } + }, + { + "block": "own-or-rent" + } + ], + "type": "Question" + }, + { + "id": "own-or-rent", + "question": { + "answers": [ + { + "id": "own-or-rent-answer", + "mandatory": true, + "options": [ + { + "label": "Owns outright", + "value": "Owns outright" + }, + { + "label": "Owns with a mortgage or loan", + "value": "Owns with a mortgage or loan" + } + ], + "type": "Radio" + } + ], + "id": "own-or-rent-question", + "title": "Does your household own or rent?", + "type": "General" + }, + "type": "Question" + } + ], + "id": "accommodation-group" + } + ], + "id": "accommodation-section", + "title": "Household accommodation" + } + ] +} diff --git a/schemas/test/en/test_list_collector.json b/schemas/test/en/test_list_collector.json new file mode 100644 index 0000000000..4dbb155473 --- /dev/null +++ b/schemas/test/en/test_list_collector.json @@ -0,0 +1,344 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test ListCollector", + "theme": "default", + "description": "A questionnaire to test ListCollector", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": {} + }, + "sections": [ + { + "id": "section", + "title": "List Collector Summary", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": "Household members", + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "cancel_text": "Don’t need to add anyone else?", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "cancel_text": "Don’t need to change anything?", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "cancel_text": "Don’t need to remove this person?", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "warning": "All of the information about this person will be deleted", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + }, + { + "id": "extra-list-group", + "title": "Another List", + "blocks": [ + { + "id": "next-interstitial", + "content": { + "title": "Another list", + "contents": [ + { + "description": "You have added some people to the ‘people’ list. Next we’ll test another list collector adding to the same list. This should still have the same list of people." + } + ] + }, + "type": "Interstitial" + }, + { + "id": "another-list-collector-block", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "another-confirmation-question", + "type": "General", + "title": "This list collector will add to the same ‘people’ list. Add someone else?", + "answers": [ + { + "id": "another-anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "another-add-person", + "type": "ListAddQuestion", + "question": { + "id": "another-add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "another-edit-person", + "type": "ListEditQuestion", + "question": { + "id": "another-edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "another-remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "another-remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "another-remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_list_collector_content_page.json b/schemas/test/en/test_list_collector_content_page.json new file mode 100644 index 0000000000..d31345c3ef --- /dev/null +++ b/schemas/test/en/test_list_collector_content_page.json @@ -0,0 +1,550 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test List Collector Section Summary Items", + "theme": "default", + "description": "A questionnaire to test list collector section summary items", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { + "required_completed_sections": ["section-companies"] + } + }, + "post_submission": { + "view_response": true + }, + "sections": [ + { + "id": "section-companies", + "title": "General insurance business", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "companies", + "title": "Companies or UK branches", + "item_anchor_answer_id": "company-or-branch-name", + "item_label": "Name of UK company or branch", + "add_link_text": "Add another UK company or branch", + "empty_list_text": "No UK company or branch added", + "related_answers": [ + { + "source": "answers", + "identifier": "registration-number" + }, + { + "source": "answers", + "identifier": "authorised-insurer-radio" + } + ] + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "group-companies", + "blocks": [ + { + "type": "ListCollectorDrivingQuestion", + "id": "any-companies-or-branches", + "for_list": "companies", + "question": { + "type": "General", + "id": "any-companies-or-branches-question", + "title": "Do any companies or branches within your United Kingdom group undertake general insurance business?", + "answers": [ + { + "type": "Radio", + "id": "any-companies-or-branches-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-company", + "list_name": "companies" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "when": { + "==": [ + { + "source": "answers", + "identifier": "any-companies-or-branches-answer" + }, + "No" + ] + }, + "block": "confirmation-checkbox" + }, + { + "block": "any-other-companies-or-branches" + } + ] + }, + { + "id": "any-other-companies-or-branches", + "type": "ListCollector", + "for_list": "companies", + "question": { + "id": "any-other-companies-or-branches-question", + "type": "General", + "title": "Do you need to add any other UK companies or branches that undertake general insurance business?", + "answers": [ + { + "id": "any-other-companies-or-branches-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-company", + "type": "ListAddQuestion", + "question": { + "id": "add-question-companies", + "type": "General", + "title": "Give details about the company or branch that undertakes general insurance business", + "answers": [ + { + "id": "company-or-branch-name", + "label": "Name of UK company or branch", + "mandatory": true, + "type": "TextField" + }, + { + "id": "registration-number", + "label": "Registration number", + "mandatory": true, + "type": "Number", + "maximum": { + "value": 999, + "exclusive": false + }, + "decimal_places": 0 + }, + { + "type": "Radio", + "label": "Is this UK company or branch an authorised insurer?", + "id": "authorised-insurer-radio", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "edit_block": { + "id": "edit-company", + "type": "ListEditQuestion", + "question": { + "id": "edit-question-companies", + "type": "General", + "title": "What is the name of the company?", + "answers": [ + { + "id": "company-or-branch-name", + "label": "Name of UK company or branch", + "mandatory": true, + "type": "TextField" + }, + { + "id": "registration-number", + "label": "Registration number", + "mandatory": true, + "type": "Number" + }, + { + "type": "Radio", + "label": "Is this UK company or branch an authorised insurer?", + "id": "authorised-insurer-radio", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "remove_block": { + "id": "remove-company", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question-companies", + "type": "General", + "title": "Are you sure you want to remove this company or UK branch?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Companies or UK branches", + "item_title": { + "text": "{company_name}", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "answers", + "identifier": "company-or-branch-name" + } + } + ] + } + } + }, + { + "type": "Question", + "id": "confirmation-checkbox", + "question": { + "answers": [ + { + "id": "confirmation-checkbox-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "confirmation-checkbox-question", + "title": "Are all companies or branches based in UK?", + "type": "General" + }, + "skip_conditions": { + "when": { + "!=": [ + { + "count": [ + { + "source": "list", + "identifier": "companies" + } + ] + }, + 3 + ] + } + } + } + ] + } + ] + }, + { + "id": "section-list-collector-contents", + "title": "List Collector Contents", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "companies", + "title": "Companies or UK branches", + "item_label": "Name of UK company or branch" + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "group-list-collector-contents", + "title": "Companies", + "blocks": [ + { + "type": "Question", + "id": "responsible-party", + "question": { + "type": "General", + "id": "responsible-party-question", + "title": "Are you the responsible party for reporting trading details for a company of branch?", + "answers": [ + { + "type": "Radio", + "id": "responsible-party-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "list-collector-content", + "when": { + "==": [ + "Yes", + { + "source": "answers", + "identifier": "responsible-party-answer" + } + ] + } + }, + { + "section": "End" + } + ] + }, + { + "id": "list-collector-content", + "type": "ListCollectorContent", + "page_title": "Companies", + "for_list": "companies", + "summary": { + "title": "Companies or UK branches", + "item_title": { + "text": "{company_name}", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "answers", + "identifier": "company-or-branch-name" + } + } + ] + } + }, + "content": { + "title": "Companies", + "contents": [ + { + "guidance": { + "contents": [ + { + "description": "Include all companies" + } + ] + } + }, + { + "definition": { + "title": "Companies definition", + "contents": [ + { + "description": "Legal entities formed by a group of individuals to engage in and operate a business enterprise in a commercial or industrial capacity." + } + ] + } + }, + { + "description": "You have previously reported the following companies. Press continue to updated registration and trading information." + } + ] + }, + "repeating_blocks": [ + { + "id": "companies-repeating-block-1", + "type": "ListRepeatingQuestion", + "question": { + "id": "companies-repeating-block-1-question", + "type": "General", + "title": { + "text": "Give details about {company_name}", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "answers", + "identifier": "company-or-branch-name" + } + } + ] + }, + "answers": [ + { + "id": "registration-number-repeating-block", + "label": "Registration number (Mandatory)", + "mandatory": true, + "type": "Number", + "maximum": { + "value": 999, + "exclusive": false + }, + "decimal_places": 0 + }, + { + "id": "registration-date-repeating-block", + "label": "Date of Registration (Mandatory)", + "mandatory": true, + "type": "Date", + "maximum": { + "value": "now" + } + } + ] + } + }, + { + "id": "companies-repeating-block-2", + "type": "ListRepeatingQuestion", + "question": { + "id": "companies-repeating-block-2-question", + "type": "General", + "title": { + "text": "Give details about how {company_name} has been trading over the past {date_difference}.", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "answers", + "identifier": "company-or-branch-name" + } + }, + { + "placeholder": "date_difference", + "transforms": [ + { + "transform": "calculate_date_difference", + "arguments": { + "first_date": { + "source": "answers", + "identifier": "registration-date-repeating-block" + }, + "second_date": { + "value": "now" + } + } + } + ] + } + ] + }, + "answers": [ + { + "type": "Radio", + "label": "Has this company been trading in the UK? (Mandatory)", + "id": "authorised-trader-uk-radio-repeating-block", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + }, + { + "type": "Radio", + "label": "Has this company been trading in the EU? (Not mandatory)", + "id": "authorised-trader-eu-radio-repeating-block", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + } + ] + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_list_collector_driving_checkbox.json b/schemas/test/en/test_list_collector_driving_checkbox.json new file mode 100644 index 0000000000..6637a42efb --- /dev/null +++ b/schemas/test/en/test_list_collector_driving_checkbox.json @@ -0,0 +1,699 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test driving checkbox question", + "theme": "default", + "description": "A questionnaire to test driving checkbox question", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section", + "title": "Who lives here?", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": "Household members", + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "Primary Person", + "blocks": [ + { + "id": "primary-person-list-collector", + "type": "PrimaryPersonListCollector", + "for_list": "people", + "add_or_edit_block": { + "id": "add-or-edit-primary-person", + "type": "PrimaryPersonListAddOrEditQuestion", + "question": { + "id": "primary-person-add-or-edit-question", + "type": "General", + "title": "What is your name?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "question": { + "id": "primary-confirmation-question", + "type": "General", + "title": "Do you live at 12 Lovely Villas?", + "answers": [ + { + "id": "you-live-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes, I usually live here", + "value": "Yes, I usually live here", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No, I don’t usually live here", + "value": "No, I don’t usually live here" + } + ] + } + ] + } + }, + { + "type": "ListCollectorDrivingQuestion", + "id": "anyone-usually-live-at", + "for_list": "people", + "question_variants": [ + { + "question": { + "id": "anyone-usually-live-at-question", + "title": "Do any of the following also usually live at 12 Lovely Villas on 21 March?", + "type": "MutuallyExclusive", + "mandatory": false, + "answers": [ + { + "type": "Checkbox", + "id": "anyone-usually-live-at-answer", + "mandatory": false, + "options": [ + { + "label": "Family Members and partners", + "value": "Family Members and partners", + "description": "Include babies born on or before 21 March, children, students and/or schoolchildren who live away during term time", + "action": { + "params": { + "block_id": "add-person", + "list_name": "people" + }, + "type": "RedirectToListAddBlock" + } + }, + { + "label": "Housemates, tenants or lodgers", + "value": "Housemates, tenants or lodgers", + "action": { + "params": { + "block_id": "add-person", + "list_name": "people" + }, + "type": "RedirectToListAddBlock" + } + } + ] + }, + { + "id": "anyone-usually-live-at-answer-exclusive", + "mandatory": false, + "options": [ + { + "label": "None of the these apply, I am the only person who usually lives here", + "value": "None of the these apply, I am the only person who usually lives here" + } + ], + "type": "Checkbox" + } + ] + }, + "when": { + "==": [ + { + "identifier": "you-live-here", + "source": "answers" + }, + "Yes, I usually live here" + ] + } + }, + { + "question": { + "id": "anyone-usually-live-at-question", + "title": "Do any of the following usually live at 12 Lovely Villas on 21 March?", + "type": "MutuallyExclusive", + "mandatory": false, + "answers": [ + { + "type": "Checkbox", + "id": "anyone-usually-live-at-answer", + "mandatory": false, + "options": [ + { + "label": "Family Members and partners", + "value": "Family Members and partners", + "description": "Include babies born on or before 21 March, children, students and/or schoolchildren who live away during term time", + "action": { + "params": { + "block_id": "add-person", + "list_name": "people" + }, + "type": "RedirectToListAddBlock" + } + }, + { + "label": "Housemates, tenants or lodgers", + "value": "Housemates, tenants or lodgers", + "action": { + "params": { + "block_id": "add-person", + "list_name": "people" + }, + "type": "RedirectToListAddBlock" + } + } + ] + }, + { + "id": "anyone-usually-live-at-answer-exclusive", + "mandatory": false, + "options": [ + { + "label": "None of these apply, no-one usually lives here", + "value": "None of these apply, no-one usually lives here" + } + ], + "type": "Checkbox" + } + ] + }, + "when": { + "==": [ + { + "identifier": "you-live-here", + "source": "answers" + }, + "No, I don’t usually live here" + ] + } + } + ], + "routing_rules": [ + { + "block": "list-collector-temporary-away-stay", + "when": { + "in": [ + "None of these apply, no-one usually lives here", + { + "identifier": "anyone-usually-live-at-answer-exclusive", + "source": "answers" + } + ] + } + }, + { + "block": "list-collector-temporary-away-stay", + "when": { + "in": [ + "None of the these apply, I am the only person who usually lives here", + { + "identifier": "anyone-usually-live-at-answer-exclusive", + "source": "answers" + } + ] + } + }, + { + "block": "list-collector" + } + ] + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes, I need to add a person", + "value": "Yes, I need to add a person", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No, I do not need to add a person", + "value": "No, I do not need to add a person" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question_variants": [ + { + "question": { + "id": "add-question", + "type": "General", + "title": "Who lives at 12 Lovely Villas?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + }, + "when": { + "==": [ + { + "source": "list", + "identifier": "people", + "selector": "count" + }, + 0 + ] + } + }, + { + "question": { + "id": "add-question", + "type": "General", + "title": "Who else lives at 12 Lovely Villas?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + }, + "when": { + ">": [ + { + "source": "list", + "identifier": "people", + "selector": "count" + }, + 0 + ] + } + } + ] + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": { + "text": "Change details for {first_name} {last_name}", + "placeholders": [ + { + "placeholder": "first_name", + "value": { + "source": "answers", + "identifier": "first-name" + } + }, + { + "placeholder": "last_name", + "value": { + "source": "answers", + "identifier": "last-name" + } + } + ] + }, + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "id": "list-collector-temporary-away-stay", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question-temporary-away-stay", + "type": "General", + "title": { + "text_plural": { + "forms": { + "one": "You said {number_of_people} person lives at 12 Lovely Villas. Do you need to add anyone?", + "other": "You said {number_of_people} people lives at 12 Lovely Villas. Do you need to add anyone?" + }, + "count": { + "source": "list", + "identifier": "people" + } + }, + "placeholders": [ + { + "placeholder": "number_of_people", + "value": { + "source": "list", + "identifier": "people", + "selector": "count" + } + } + ] + }, + "answers": [ + { + "id": "anyone-else-temporary-away-stay", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes, I need to add someone", + "value": "Yes, I need to add someone", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": { + "text_plural": { + "forms": { + "one": "No there is {number_of_people} person living here", + "other": "No there are {number_of_people} people living here" + }, + "count": { + "source": "list", + "identifier": "people" + } + }, + "placeholders": [ + { + "placeholder": "number_of_people", + "value": { + "source": "list", + "identifier": "people", + "selector": "count" + } + } + ] + }, + "value": "No there are {number_of_people} people living here" + } + ] + } + ] + }, + "add_block": { + "id": "add-person-temporary-away-stay", + "type": "ListAddQuestion", + "question_variants": [ + { + "question": { + "id": "add-question-temporary-away-stay", + "type": "General", + "title": "Who lives at 12 Lovely Villas?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + }, + "when": { + "==": [ + { + "source": "list", + "identifier": "people", + "selector": "count" + }, + 0 + ] + } + }, + { + "question": { + "id": "add-question-temporary-away-stay", + "type": "General", + "title": "Who else lives at 12 Lovely Villas?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + }, + "when": { + ">": [ + { + "source": "list", + "identifier": "people", + "selector": "count" + }, + 0 + ] + } + } + ] + }, + "edit_block": { + "id": "edit-person-temporary-away-stay", + "type": "ListEditQuestion", + "question": { + "id": "edit-question-temporary-away-stay", + "type": "General", + "title": { + "text": "Change details for {first_name} {last_name}", + "placeholders": [ + { + "placeholder": "first_name", + "value": { + "source": "answers", + "identifier": "first-name" + } + }, + { + "placeholder": "last_name", + "value": { + "source": "answers", + "identifier": "last-name" + } + } + ] + }, + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person-temporary-away-stay", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question-temporary-away-stay", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation-temporary-away-stay", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_list_collector_driving_question.json b/schemas/test/en/test_list_collector_driving_question.json new file mode 100644 index 0000000000..9046699d67 --- /dev/null +++ b/schemas/test/en/test_list_collector_driving_question.json @@ -0,0 +1,251 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test ListCollectorDrivingQuestion", + "theme": "default", + "description": "A questionnaire to test ListCollectorDrivingQuestion", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section", + "title": "List Collector Driving Question Summary", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": "Household members", + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "type": "ListCollectorDrivingQuestion", + "id": "anyone-usually-live-at", + "for_list": "people", + "question": { + "type": "General", + "id": "anyone-usually-live-at-question", + "title": "Does anyone usually live at 1 Pleasant Lane?", + "guidance": { + "contents": [ + { + "title": "Outcomes", + "list": [ + "`None of the these apply, I am the only person who usually lives here` - Takes you directly to the list collector.", + "Any of the other checkboxes and the list is empty - Takes you to the list collector‘s add question.", + "Any of the other checkboxes and the list is not empty - Takes you directly to the list collector." + ] + } + ] + }, + "answers": [ + { + "type": "Radio", + "id": "anyone-usually-live-at-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-person", + "list_name": "people" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "section": "End", + "when": { + "==": [ + { + "source": "answers", + "identifier": "anyone-usually-live-at-answer" + }, + "No" + ] + } + }, + { + "block": "anyone-else-live-at" + } + ] + }, + { + "id": "anyone-else-live-at", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live at 1 Pleasant Lane?", + "answers": [ + { + "id": "anyone-else-live-at-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_list_collector_list_summary.json b/schemas/test/en/test_list_collector_list_summary.json new file mode 100644 index 0000000000..b07504fe6e --- /dev/null +++ b/schemas/test/en/test_list_collector_list_summary.json @@ -0,0 +1,528 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test ListCollector", + "preview_questions": true, + "theme": "default", + "description": "A questionnaire to test ListCollector", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "display_address", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": {} + }, + "individual_response": { + "for_list": "people", + "individual_section_id": "section" + }, + "sections": [ + { + "id": "section", + "title": "People who live here and overnight visitors", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": { + "text": "Household members staying overnight on {date} at {household_address}", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "arguments": { + "date_format": "d MMMM yyyy", + "date_to_format": { + "value": "2019-10-13" + } + }, + "transform": "format_date" + } + ] + }, + { + "placeholder": "household_address", + "value": { + "identifier": "display_address", + "source": "metadata" + } + } + ] + }, + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + }, + { + "type": "List", + "for_list": "visitors", + "title": { + "text": "Visitors staying overnight on {date} at {household_address}", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "arguments": { + "date_format": "d MMMM yyyy", + "date_to_format": { + "value": "2019-10-13" + } + }, + "transform": "format_date" + } + ] + }, + { + "placeholder": "household_address", + "value": { + "identifier": "display_address", + "source": "metadata" + } + } + ] + }, + "add_link_text": "Add another visitor to this household", + "empty_list_text": "There are no visitors" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "Questions", + "blocks": [ + { + "id": "introduction", + "type": "Introduction" + }, + { + "id": "primary-person-list-collector", + "type": "PrimaryPersonListCollector", + "for_list": "people", + "add_or_edit_block": { + "id": "add-or-edit-primary-person", + "type": "PrimaryPersonListAddOrEditQuestion", + "question": { + "id": "primary-person-add-or-edit-question", + "type": "General", + "title": "What is your name?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "question": { + "id": "primary-confirmation-question", + "type": "General", + "title": { + "placeholders": [ + { + "placeholder": "household_address", + "value": { + "identifier": "display_address", + "source": "metadata" + } + } + ], + "text": "Do you live at {household_address}?" + }, + "answers": [ + { + "id": "you-live-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": { + "placeholders": [ + { + "placeholder": "household_address", + "value": { + "identifier": "display_address", + "source": "metadata" + } + } + ], + "text": "Does anyone else live at {household_address}?" + }, + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": { + "text": "Household members staying overnight on {date} at {household_address}", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "arguments": { + "date_format": "d MMMM yyyy", + "date_to_format": { + "value": "2019-10-13" + } + }, + "transform": "format_date" + } + ] + }, + { + "placeholder": "household_address", + "value": { + "identifier": "display_address", + "source": "metadata" + } + } + ] + }, + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "id": "visitor-list-collector", + "type": "ListCollector", + "for_list": "visitors", + "question": { + "id": "confirmation-visitor-question", + "type": "General", + "title": { + "placeholders": [ + { + "placeholder": "household_address", + "value": { + "identifier": "display_address", + "source": "metadata" + } + } + ], + "text": "Are there any other visitors staying overnight at {household_address}?" + }, + "answers": [ + { + "id": "any-more-visitors", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-visitor", + "type": "ListAddQuestion", + "question": { + "id": "add-visitor-question", + "type": "General", + "title": "What is the name of the visitor?", + "answers": [ + { + "id": "first-name-visitor", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name-visitor", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-visitor-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-visitor-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name-visitor", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name-visitor", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-visitor", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-visitor-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-visitor-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": { + "text": "Visitors staying overnight on {date} at {household_address}", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "arguments": { + "date_format": "d MMMM yyyy", + "date_to_format": { + "value": "2019-10-13" + } + }, + "transform": "format_date" + } + ] + }, + { + "placeholder": "household_address", + "value": { + "identifier": "display_address", + "source": "metadata" + } + } + ] + }, + "item_title": { + "text": "{visitor_name}", + "placeholders": [ + { + "placeholder": "visitor_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name-visitor" + }, + { + "source": "answers", + "identifier": "last-name-visitor" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_list_collector_primary_and_collector_with_driving_question.json b/schemas/test/en/test_list_collector_primary_and_collector_with_driving_question.json new file mode 100644 index 0000000000..5b47d6e0d5 --- /dev/null +++ b/schemas/test/en/test_list_collector_primary_and_collector_with_driving_question.json @@ -0,0 +1,304 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test ListCollectorPrimaryAndCollectorWithDrivingQuestion", + "theme": "default", + "description": "A questionnaire to test ListCollectorPrimaryAndCollectorWithDrivingQuestion", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section", + "title": "List Collector Primary And Collector With Driving Question Summary", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": "Household members", + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "primary-person-list-collector", + "type": "PrimaryPersonListCollector", + "for_list": "people", + "add_or_edit_block": { + "id": "add-or-edit-primary-person", + "type": "PrimaryPersonListAddOrEditQuestion", + "question": { + "id": "primary-person-add-or-edit-question", + "type": "General", + "title": "What is your name", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "question": { + "id": "primary-confirmation-question", + "type": "General", + "title": "Do you live here?", + "answers": [ + { + "id": "you-live-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "type": "ListCollectorDrivingQuestion", + "id": "anyone-else-usually-live-at", + "for_list": "people", + "question": { + "type": "General", + "id": "anyone-else-usually-live-at-question", + "title": "Does anyone else usually live at 1 Pleasant Lane?", + "guidance": { + "contents": [ + { + "title": "Outcomes", + "list": [ + "`None of the these apply, I am the only person who usually lives here` - Takes you directly to the list collector.", + "Any of the other checkboxes and the list is empty - Takes you to the list collector‘s add question.", + "Any of the other checkboxes and the list is not empty - Takes you directly to the list collector." + ] + } + ] + }, + "answers": [ + { + "type": "Radio", + "id": "anyone-else-usually-live-at-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-person", + "list_name": "people" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "section": "End", + "when": { + "==": [ + { + "source": "answers", + "identifier": "anyone-else-usually-live-at-answer" + }, + "No" + ] + } + }, + { + "block": "anyone-else-live-at" + } + ] + }, + { + "id": "anyone-else-live-at", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live at 1 Pleasant Lane?", + "answers": [ + { + "id": "anyone-else-live-at-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_list_collector_primary_person.json b/schemas/test/en/test_list_collector_primary_person.json new file mode 100644 index 0000000000..1ada4c69aa --- /dev/null +++ b/schemas/test/en/test_list_collector_primary_person.json @@ -0,0 +1,341 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test PrimaryPersonListCollector", + "theme": "default", + "description": "A questionnaire to test Primary Person ListCollector", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": {} + }, + "submission": { + "button": "Submit answers", + "guidance": "Thank you for your answers, do you wish to submit", + "title": "Submit answers", + "warning": "You cannot view your answers after submission" + }, + "sections": [ + { + "id": "section", + "title": "Household members", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": "Household members", + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "Primary Person", + "blocks": [ + { + "id": "primary-person-list-collector", + "type": "PrimaryPersonListCollector", + "for_list": "people", + "add_or_edit_block": { + "id": "add-or-edit-primary-person", + "type": "PrimaryPersonListAddOrEditQuestion", + "question": { + "id": "primary-person-add-or-edit-question", + "type": "General", + "title": "What is your name", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "question": { + "id": "primary-confirmation-question", + "type": "General", + "title": "Do you live here?", + "answers": [ + { + "id": "you-live-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "id": "anyone-usually-live-at", + "question": { + "answers": [ + { + "id": "anyone-usually-live-at-answer", + "mandatory": true, + "options": [ + { + "action": { + "params": { + "block_id": "add-person", + "list_name": "people" + }, + "type": "RedirectToListAddBlock" + }, + "label": "Yes", + "value": "Yes" + }, + { + "description": "For example, this is a second address or holiday home", + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "anyone-usually-live-at-question", + "title": "Does anyone else live at your address?", + "type": "General" + }, + "routing_rules": [ + { + "section": "End", + "when": { + "and": [ + { + "==": [ + { + "source": "answers", + "identifier": "anyone-usually-live-at-answer" + }, + "No" + ] + }, + { + "<": [ + { + "source": "list", + "identifier": "people", + "selector": "count" + }, + 1 + ] + } + ] + } + }, + { + "block": "list-collector" + } + ], + "skip_conditions": { + "when": { + "==": [ + { + "source": "answers", + "identifier": "you-live-here" + }, + "Yes" + ] + } + }, + "type": "Question" + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": { + "text": "Change details for {first_name} {last_name}", + "placeholders": [ + { + "placeholder": "first_name", + "value": { + "source": "answers", + "identifier": "first-name" + } + }, + { + "placeholder": "last_name", + "value": { + "source": "answers", + "identifier": "last-name" + } + } + ] + }, + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_list_collector_repeating_blocks_section_summary.json b/schemas/test/en/test_list_collector_repeating_blocks_section_summary.json new file mode 100644 index 0000000000..c43fe8b93e --- /dev/null +++ b/schemas/test/en/test_list_collector_repeating_blocks_section_summary.json @@ -0,0 +1,432 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test a List Collector with Repeating Blocks and Section Summary Items", + "theme": "default", + "description": "A questionnaire to test a list collector with repeating blocks and section summary items", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "answer_codes": [ + { + "answer_id": "responsible-party-answer", + "code": "1" + }, + { + "answer_id": "any-companies-or-branches-answer", + "code": "2" + }, + { + "answer_id": "company-or-branch-name", + "code": "2a" + }, + { + "answer_id": "registration-number", + "code": "2b" + }, + { + "answer_id": "registration-date", + "code": "2c" + }, + { + "answer_id": "authorised-trader-uk-radio", + "code": "2d" + }, + { + "answer_id": "authorised-trader-eu-radio", + "code": "2e" + }, + { + "answer_id": "any-other-companies-or-branches-answer", + "code": "3" + }, + { + "answer_id": "any-other-trading-details-answer", + "code": "4" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section-companies", + "title": "General insurance business", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "companies", + "title": "Companies or UK branches", + "item_anchor_answer_id": "company-or-branch-name", + "item_label": "Name of UK company or branch", + "add_link_text": "Add another UK company or branch", + "empty_list_text": "No UK company or branch added" + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "group-companies", + "blocks": [ + { + "type": "Question", + "id": "responsible-party", + "question": { + "type": "General", + "id": "responsible-party-question", + "title": "Are you the responsible party for reporting trading details for a company of branch?", + "answers": [ + { + "type": "Radio", + "id": "responsible-party-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "any-companies-or-branches", + "when": { + "==": [ + "Yes", + { + "source": "answers", + "identifier": "responsible-party-answer" + } + ] + } + }, + { + "section": "End" + } + ] + }, + { + "type": "ListCollectorDrivingQuestion", + "id": "any-companies-or-branches", + "for_list": "companies", + "question": { + "type": "General", + "id": "any-companies-or-branches-question", + "title": "Do any companies or branches within your United Kingdom group undertake general insurance business?", + "answers": [ + { + "type": "Radio", + "id": "any-companies-or-branches-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-company", + "list_name": "companies" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "when": { + "==": [ + { + "source": "answers", + "identifier": "any-companies-or-branches-answer" + }, + "Yes" + ] + }, + "block": "any-other-companies-or-branches" + }, + { + "section": "End" + } + ] + }, + { + "id": "any-other-companies-or-branches", + "type": "ListCollector", + "for_list": "companies", + "question": { + "id": "any-other-companies-or-branches-question", + "type": "General", + "title": "Do you need to add any other UK companies or branches that undertake general insurance business?", + "answers": [ + { + "id": "any-other-companies-or-branches-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-company", + "type": "ListAddQuestion", + "question": { + "id": "add-question-companies", + "type": "General", + "title": "What is the name and registration number of the company?", + "answers": [ + { + "id": "company-or-branch-name", + "label": "Name of UK company or branch (Mandatory)", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "repeating_blocks": [ + { + "id": "companies-repeating-block-1", + "type": "ListRepeatingQuestion", + "question": { + "id": "companies-repeating-block-1-question", + "type": "General", + "title": { + "text": "Give details about {company_name}", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "answers", + "identifier": "company-or-branch-name" + } + } + ] + }, + "answers": [ + { + "id": "registration-number", + "label": "Registration number (Mandatory)", + "mandatory": true, + "type": "Number", + "maximum": { + "value": 999, + "exclusive": false + }, + "decimal_places": 0 + }, + { + "id": "registration-date", + "label": "Date of Registration (Mandatory)", + "mandatory": true, + "type": "Date", + "maximum": { + "value": "now" + } + } + ] + } + }, + { + "id": "companies-repeating-block-2", + "type": "ListRepeatingQuestion", + "question": { + "id": "companies-repeating-block-2-question", + "type": "General", + "title": { + "text": "Give details about how {company_name} has been trading over the past {date_difference}.", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "answers", + "identifier": "company-or-branch-name" + } + }, + { + "placeholder": "date_difference", + "transforms": [ + { + "transform": "calculate_date_difference", + "arguments": { + "first_date": { + "source": "answers", + "identifier": "registration-date" + }, + "second_date": { + "value": "now" + } + } + } + ] + } + ] + }, + "answers": [ + { + "type": "Radio", + "label": "Has this company been trading in the UK? (Mandatory)", + "id": "authorised-trader-uk-radio", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + }, + { + "type": "Radio", + "label": "Has this company been trading in the EU? (Not mandatory)", + "id": "authorised-trader-eu-radio", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + } + ], + "edit_block": { + "id": "edit-company", + "type": "ListEditQuestion", + "question": { + "id": "edit-question-companies", + "type": "General", + "title": "What is the name and registration number of the company?", + "answers": [ + { + "id": "company-or-branch-name", + "label": "Name of UK company or branch (Mandatory)", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-company", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question-companies", + "type": "General", + "title": "Are you sure you want to remove this company or UK branch?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Companies or UK branches", + "item_title": { + "text": "{company_name}", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "answers", + "identifier": "company-or-branch-name" + } + } + ] + } + } + }, + { + "id": "any-other-trading-details", + "type": "Question", + "question": { + "id": "any-other-trading-details-question", + "type": "General", + "title": "Do you have any other details about the trading you have reported for?", + "answers": [ + { + "id": "any-other-trading-details-answer", + "label": "Additional details", + "mandatory": false, + "type": "TextField" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_list_collector_repeating_blocks_with_hub.json b/schemas/test/en/test_list_collector_repeating_blocks_with_hub.json new file mode 100644 index 0000000000..9eff68c1a7 --- /dev/null +++ b/schemas/test/en/test_list_collector_repeating_blocks_with_hub.json @@ -0,0 +1,826 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test a List Collector with Repeating Blocks and Section Summary Items", + "theme": "default", + "description": "A questionnaire to test a list collector with repeating blocks and section summary items", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "answer_codes": [ + { + "answer_id": "responsible-party-answer", + "code": "1" + }, + { + "answer_id": "any-companies-or-branches-answer", + "code": "2" + }, + { + "answer_id": "company-or-branch-name", + "code": "2a" + }, + { + "answer_id": "registration-number", + "code": "2b" + }, + { + "answer_id": "registration-date", + "code": "2c" + }, + { + "answer_id": "authorised-trader-uk-radio", + "code": "2d" + }, + { + "answer_id": "authorised-trader-eu-radio", + "code": "2e" + }, + { + "answer_id": "any-other-companies-or-branches-answer", + "code": "3" + }, + { + "answer_id": "any-other-trading-details-answer", + "code": "4" + }, + { + "answer_id": "responsible-party-business-answer", + "code": "5" + }, + { + "answer_id": "any-businesses-or-branches-answer", + "code": "6" + }, + { + "answer_id": "business-or-branch-name", + "code": "6a" + }, + { + "answer_id": "registration-business-number", + "code": "6b" + }, + { + "answer_id": "registration-business-date", + "code": "6c" + }, + { + "answer_id": "authorised-business-trader-uk-radio", + "code": "6d" + }, + { + "answer_id": "authorised-business-trader-eu-radio", + "code": "6e" + }, + { + "answer_id": "any-other-business-businesses-or-branches-answer", + "code": "7" + }, + { + "answer_id": "any-other-business-trading-details-answer", + "code": "8" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { + "required_completed_sections": ["section-companies"] + } + }, + "sections": [ + { + "id": "section-companies", + "title": "General insurance companies", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "companies", + "title": "Companies or UK branches", + "item_anchor_answer_id": "company-or-branch-name", + "item_label": "Name of UK company or branch", + "add_link_text": "Add another UK company or branch", + "empty_list_text": "No UK company or branch added" + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "group-companies", + "blocks": [ + { + "type": "Question", + "id": "responsible-party", + "question": { + "type": "General", + "id": "responsible-party-question", + "title": "Are you the responsible party for reporting trading details for a company of branch?", + "answers": [ + { + "type": "Radio", + "id": "responsible-party-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "any-companies-or-branches", + "when": { + "==": [ + "Yes", + { + "source": "answers", + "identifier": "responsible-party-answer" + } + ] + } + }, + { + "section": "End" + } + ] + }, + { + "type": "ListCollectorDrivingQuestion", + "id": "any-companies-or-branches", + "for_list": "companies", + "question": { + "type": "General", + "id": "any-companies-or-branches-question", + "title": "Do any companies or branches within your United Kingdom group undertake general insurance business?", + "answers": [ + { + "type": "Radio", + "id": "any-companies-or-branches-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-company", + "list_name": "companies" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "when": { + "==": [ + { + "source": "answers", + "identifier": "any-companies-or-branches-answer" + }, + "Yes" + ] + }, + "block": "any-other-companies-or-branches" + }, + { + "section": "End" + } + ] + }, + { + "id": "any-other-companies-or-branches", + "type": "ListCollector", + "for_list": "companies", + "question": { + "id": "any-other-companies-or-branches-question", + "type": "General", + "title": "Do you need to add any other UK companies or branches that undertake general insurance business?", + "answers": [ + { + "id": "any-other-companies-or-branches-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-company", + "type": "ListAddQuestion", + "question": { + "id": "add-question-companies", + "type": "General", + "title": "What is the name and registration number of the company?", + "answers": [ + { + "id": "company-or-branch-name", + "label": "Name of UK company or branch (Mandatory)", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "repeating_blocks": [ + { + "id": "companies-repeating-block-1", + "type": "ListRepeatingQuestion", + "question": { + "id": "companies-repeating-block-1-question", + "type": "General", + "title": { + "text": "Give details about {company_name}", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "answers", + "identifier": "company-or-branch-name" + } + } + ] + }, + "answers": [ + { + "id": "registration-number", + "label": "Registration number (Mandatory)", + "mandatory": true, + "type": "Number", + "maximum": { + "value": 999, + "exclusive": false + }, + "decimal_places": 0 + }, + { + "id": "registration-date", + "label": "Date of Registration (Mandatory)", + "mandatory": true, + "type": "Date", + "maximum": { + "value": "now" + } + } + ] + } + }, + { + "id": "companies-repeating-block-2", + "type": "ListRepeatingQuestion", + "question": { + "id": "companies-repeating-block-2-question", + "type": "General", + "title": { + "text": "Give details about how {company_name} has been trading over the past {date_difference}.", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "answers", + "identifier": "company-or-branch-name" + } + }, + { + "placeholder": "date_difference", + "transforms": [ + { + "transform": "calculate_date_difference", + "arguments": { + "first_date": { + "source": "answers", + "identifier": "registration-date" + }, + "second_date": { + "value": "now" + } + } + } + ] + } + ] + }, + "answers": [ + { + "type": "Radio", + "label": "Has this company been trading in the UK? (Mandatory)", + "id": "authorised-trader-uk-radio", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + }, + { + "type": "Radio", + "label": "Has this company been trading in the EU? (Not mandatory)", + "id": "authorised-trader-eu-radio", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + } + ], + "edit_block": { + "id": "edit-company", + "type": "ListEditQuestion", + "question": { + "id": "edit-question-companies", + "type": "General", + "title": "What is the name and registration number of the company?", + "answers": [ + { + "id": "company-or-branch-name", + "label": "Name of UK company or branch (Mandatory)", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-company", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question-companies", + "type": "General", + "title": "Are you sure you want to remove this company or UK branch?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Companies or UK branches", + "item_title": { + "text": "{company_name}", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "answers", + "identifier": "company-or-branch-name" + } + } + ] + } + } + }, + { + "id": "any-other-trading-details", + "type": "Question", + "question": { + "id": "any-other-trading-details-question", + "type": "General", + "title": "Do you have any other details about the trading you have reported for?", + "answers": [ + { + "id": "any-other-trading-details-answer", + "label": "Additional details", + "mandatory": false, + "type": "TextField" + } + ] + } + } + ] + } + ] + }, + { + "id": "section-businesses", + "title": "General insurance business", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "businesses", + "title": "Businesses or UK branches", + "item_anchor_answer_id": "business-or-branch-name", + "item_label": "Name of UK business or branch", + "add_link_text": "Add another UK business or branch", + "empty_list_text": "No UK business or branch added" + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "group-businesses", + "blocks": [ + { + "type": "Question", + "id": "responsible-party-business", + "question": { + "type": "General", + "id": "responsible-party-business-question", + "title": "Are you the responsible party for reporting trading details for a business of branch?", + "answers": [ + { + "type": "Radio", + "id": "responsible-party-business-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "any-businesses-or-branches", + "when": { + "==": [ + "Yes", + { + "source": "answers", + "identifier": "responsible-party-business-answer" + } + ] + } + }, + { + "section": "End" + } + ] + }, + { + "type": "ListCollectorDrivingQuestion", + "id": "any-businesses-or-branches", + "for_list": "businesses", + "question": { + "type": "General", + "id": "any-businesses-or-branches-question", + "title": "Do any businesses or branches within your United Kingdom group undertake general insurance business?", + "answers": [ + { + "type": "Radio", + "id": "any-businesses-or-branches-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-business", + "list_name": "businesses" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "when": { + "==": [ + { + "source": "answers", + "identifier": "any-businesses-or-branches-answer" + }, + "Yes" + ] + }, + "block": "any-other-business-businesses-or-branches" + }, + { + "section": "End" + } + ] + }, + { + "id": "any-other-business-businesses-or-branches", + "type": "ListCollector", + "for_list": "businesses", + "question": { + "id": "any-other-business-businesses-or-branches-question", + "type": "General", + "title": "Do you need to add any other UK businesses or branches that undertake general insurance business?", + "answers": [ + { + "id": "any-other-business-businesses-or-branches-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-business", + "type": "ListAddQuestion", + "question": { + "id": "add-question-businesses", + "type": "General", + "title": "What is the name and registration number of the business?", + "answers": [ + { + "id": "business-or-branch-name", + "label": "Name of UK business or branch (Mandatory)", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "repeating_blocks": [ + { + "id": "businesses-repeating-block-1", + "type": "ListRepeatingQuestion", + "question": { + "id": "businesses-repeating-block-1-question", + "type": "General", + "title": { + "text": "Give details about {business_name}", + "placeholders": [ + { + "placeholder": "business_name", + "value": { + "source": "answers", + "identifier": "business-or-branch-name" + } + } + ] + }, + "answers": [ + { + "id": "registration-business-number", + "label": "Registration number (Mandatory)", + "mandatory": true, + "type": "Number", + "maximum": { + "value": 999, + "exclusive": false + }, + "decimal_places": 0 + }, + { + "id": "registration-business-date", + "label": "Date of Registration (Mandatory)", + "mandatory": true, + "type": "Date", + "maximum": { + "value": "now" + } + } + ] + } + }, + { + "id": "businesses-repeating-block-2", + "type": "ListRepeatingQuestion", + "question": { + "id": "businesses-repeating-block-2-question", + "type": "General", + "title": { + "text": "Give details about how {business_name} has been trading over the past {date_difference}.", + "placeholders": [ + { + "placeholder": "business_name", + "value": { + "source": "answers", + "identifier": "business-or-branch-name" + } + }, + { + "placeholder": "date_difference", + "transforms": [ + { + "transform": "calculate_date_difference", + "arguments": { + "first_date": { + "source": "answers", + "identifier": "registration-business-date" + }, + "second_date": { + "value": "now" + } + } + } + ] + } + ] + }, + "answers": [ + { + "type": "Radio", + "label": "Has this business been trading in the UK? (Mandatory)", + "id": "authorised-business-trader-uk-radio", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + }, + { + "type": "Radio", + "label": "Has this business been trading in the EU? (Not mandatory)", + "id": "authorised-business-trader-eu-radio", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + } + ], + "edit_block": { + "id": "edit-business", + "type": "ListEditQuestion", + "question": { + "id": "edit-question-businesses", + "type": "General", + "title": "What is the name and registration number of the business?", + "answers": [ + { + "id": "business-or-branch-name", + "label": "Name of UK business or branch (Mandatory)", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-business", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question-businesses", + "type": "General", + "title": "Are you sure you want to remove this business or UK branch?", + "answers": [ + { + "id": "remove-confirmation-business", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Businesses or UK branches", + "item_title": { + "text": "{business_name}", + "placeholders": [ + { + "placeholder": "business_name", + "value": { + "source": "answers", + "identifier": "business-or-branch-name" + } + } + ] + } + } + }, + { + "id": "any-other-business-trading-details", + "type": "Question", + "question": { + "id": "any-other-business-trading-details-question", + "type": "General", + "title": "Do you have any other details about the trading you have reported for?", + "answers": [ + { + "id": "any-other-business-trading-details-answer", + "label": "Additional details", + "mandatory": false, + "type": "TextField" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_list_collector_same_name_items.json b/schemas/test/en/test_list_collector_same_name_items.json new file mode 100644 index 0000000000..18109e2242 --- /dev/null +++ b/schemas/test/en/test_list_collector_same_name_items.json @@ -0,0 +1,394 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Same Name items", + "theme": "default", + "description": "A questionnaire to test ListCollectors where names may be the same", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": {} + }, + "sections": [ + { + "id": "section", + "title": "Household members", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": "Household members", + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "Primary Person", + "blocks": [ + { + "id": "primary-person-list-collector", + "type": "PrimaryPersonListCollector", + "for_list": "people", + "same_name_answer_ids": ["first-name", "last-name"], + "add_or_edit_block": { + "id": "add-or-edit-primary-person", + "type": "PrimaryPersonListAddOrEditQuestion", + "question": { + "id": "primary-person-add-or-edit-question", + "type": "General", + "title": "What is your name", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "middle-names", + "label": "Middle names", + "mandatory": false, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "question": { + "id": "primary-confirmation-question", + "type": "General", + "title": "Do you live here?", + "answers": [ + { + "id": "you-live-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "id": "anyone-usually-live-at", + "question": { + "answers": [ + { + "id": "anyone-usually-live-at-answer", + "mandatory": true, + "options": [ + { + "action": { + "params": { + "block_id": "add-person", + "list_name": "people" + }, + "type": "RedirectToListAddBlock" + }, + "label": "Yes", + "value": "Yes" + }, + { + "description": "For example, this is a second address or holiday home", + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "anyone-usually-live-at-question", + "title": "Does anyone else live at your address?", + "type": "General" + }, + "routing_rules": [ + { + "section": "End", + "when": { + "and": [ + { + "==": [ + { + "identifier": "anyone-usually-live-at-answer", + "source": "answers" + }, + "No" + ] + }, + { + "<": [ + { + "source": "list", + "identifier": "people", + "selector": "count" + }, + 1 + ] + } + ] + } + }, + { + "block": "list-collector" + } + ], + "skip_conditions": { + "when": { + "==": [ + { + "source": "answers", + "identifier": "you-live-here" + }, + "Yes" + ] + } + }, + "type": "Question" + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "same_name_answer_ids": ["first-name", "last-name"], + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "middle-names", + "label": "Middle names", + "mandatory": false, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": { + "text": "Change details for {person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "contains", + "arguments": { + "list_to_check": { + "source": "list", + "selector": "same_name_items", + "identifier": "people" + }, + "value": { + "source": "location", + "identifier": "list_item_id" + } + } + }, + { + "transform": "format_name", + "arguments": { + "include_middle_names": { + "source": "previous_transform" + }, + "first_name": { + "source": "answers", + "identifier": "first-name" + }, + "middle_names": { + "source": "answers", + "identifier": "middle-names" + }, + "last_name": { + "source": "answers", + "identifier": "last-name" + } + } + } + ] + } + ] + }, + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "middle-names", + "label": "Middle names", + "mandatory": false, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "list_has_items", + "arguments": { + "list_to_check": { + "source": "list", + "selector": "same_name_items", + "identifier": "people" + } + } + }, + { + "transform": "format_name", + "arguments": { + "include_middle_names": { + "source": "previous_transform" + }, + "first_name": { + "source": "answers", + "identifier": "first-name" + }, + "middle_names": { + "source": "answers", + "identifier": "middle-names" + }, + "last_name": { + "source": "answers", + "identifier": "last-name" + } + } + } + ] + } + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_list_collector_section_summary.json b/schemas/test/en/test_list_collector_section_summary.json new file mode 100644 index 0000000000..f739e7583d --- /dev/null +++ b/schemas/test/en/test_list_collector_section_summary.json @@ -0,0 +1,549 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test List Collector Section Summary Items", + "theme": "default", + "description": "A questionnaire to test list collector section summary items", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "post_submission": { + "view_response": true + }, + "answer_codes": [ + { + "answer_id": "any-companies-or-branches-answer", + "code": "1" + }, + { + "answer_id": "company-or-branch-name", + "code": "1a" + }, + { + "answer_id": "registration-number", + "code": "1b" + }, + { + "answer_id": "authorised-insurer-radio", + "code": "1c" + }, + { + "answer_id": "any-other-companies-or-branches-answer", + "code": "2" + }, + { + "answer_id": "confirmation-checkbox-answer", + "code": "3" + }, + { + "answer_id": "anyone-else", + "code": "4" + }, + { + "answer_id": "householder-checkbox-answer", + "code": "5" + }, + { + "answer_id": "first-name", + "code": "6" + }, + { + "answer_id": "last-name", + "code": "7" + } + ], + "sections": [ + { + "id": "section-companies", + "title": "General insurance business", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "companies", + "title": "Companies or UK branches", + "item_anchor_answer_id": "company-or-branch-name", + "item_label": "Name of UK company or branch", + "add_link_text": "Add another UK company or branch", + "empty_list_text": "No UK company or branch added", + "related_answers": [ + { + "source": "answers", + "identifier": "registration-number" + }, + { + "source": "answers", + "identifier": "authorised-insurer-radio" + } + ] + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "group-companies", + "blocks": [ + { + "type": "ListCollectorDrivingQuestion", + "id": "any-companies-or-branches", + "for_list": "companies", + "question": { + "type": "General", + "id": "any-companies-or-branches-question", + "title": "Do any companies or branches within your United Kingdom group undertake general insurance business?", + "answers": [ + { + "type": "Radio", + "id": "any-companies-or-branches-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-company", + "list_name": "companies" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "when": { + "==": [{ "source": "answers", "identifier": "any-companies-or-branches-answer" }, "No"] + }, + "block": "confirmation-checkbox" + }, + { + "block": "any-other-companies-or-branches" + } + ] + }, + { + "id": "any-other-companies-or-branches", + "type": "ListCollector", + "for_list": "companies", + "question": { + "id": "any-other-companies-or-branches-question", + "type": "General", + "title": "Do you need to add any other UK companies or branches that undertake general insurance business?", + "answers": [ + { + "id": "any-other-companies-or-branches-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-company", + "type": "ListAddQuestion", + "question": { + "id": "add-question-companies", + "type": "General", + "title": "Give details about the company or branch that undertakes general insurance business", + "answers": [ + { + "id": "company-or-branch-name", + "label": "Name of UK company or branch", + "mandatory": true, + "type": "TextField" + }, + { + "id": "registration-number", + "label": "Registration number", + "mandatory": true, + "type": "Number", + "maximum": { + "value": 999, + "exclusive": false + }, + "decimal_places": 0 + }, + { + "type": "Radio", + "label": "Is this UK company or branch an authorised insurer?", + "id": "authorised-insurer-radio", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "edit_block": { + "id": "edit-company", + "type": "ListEditQuestion", + "question": { + "id": "edit-question-companies", + "type": "General", + "title": "What is the name of the company?", + "answers": [ + { + "id": "company-or-branch-name", + "label": "Name of UK company or branch", + "mandatory": true, + "type": "TextField" + }, + { + "id": "registration-number", + "label": "Registration number", + "mandatory": true, + "type": "Number" + }, + { + "type": "Radio", + "label": "Is this UK company or branch an authorised insurer?", + "id": "authorised-insurer-radio", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "remove_block": { + "id": "remove-company", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question-companies", + "type": "General", + "title": "Are you sure you want to remove this company or UK branch?", + "answers": [ + { + "id": "remove-confirmation-company", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Companies or UK branches", + "item_title": { + "text": "{company_name}", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "answers", + "identifier": "company-or-branch-name" + } + } + ] + } + } + }, + { + "type": "Question", + "id": "confirmation-checkbox", + "question": { + "answers": [ + { + "id": "confirmation-checkbox-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "confirmation-checkbox-question", + "title": "Are all companies or branches based in UK?", + "type": "General" + }, + "skip_conditions": { + "when": { + "!=": [ + { + "count": [ + { + "source": "list", + "identifier": "companies" + } + ] + }, + 3 + ] + } + } + } + ] + } + ] + }, + { + "id": "section-household", + "title": "Household Section", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": "Who lives here", + "item_anchor_answer_id": "first-name", + "item_label": "Name of householder", + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "group-household", + "title": "Household Questions", + "blocks": [ + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "cancel_text": "Don’t need to add anyone else?", + "question": { + "id": "add-question-people", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "cancel_text": "Don’t need to change anything?", + "question": { + "id": "edit-question-people", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "cancel_text": "Don’t need to remove this person?", + "question": { + "id": "remove-question-people", + "type": "General", + "title": "Are you sure you want to remove this person?", + "warning": "All of the information about this person will be deleted", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "type": "Question", + "id": "householder-checkbox", + "question": { + "answers": [ + { + "id": "householder-checkbox-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "householder-checkbox-question", + "title": "Are all these people based in the UK?", + "type": "General" + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_list_collector_two_list_collectors.json b/schemas/test/en/test_list_collector_two_list_collectors.json new file mode 100644 index 0000000000..8f6c798d43 --- /dev/null +++ b/schemas/test/en/test_list_collector_two_list_collectors.json @@ -0,0 +1,436 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test PrimaryAndTwoListCollectors", + "theme": "default", + "description": "A questionnaire to test Primary Person ListCollector and two ListCollectors", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": {} + }, + "sections": [ + { + "id": "section", + "title": "Household members", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": "Household members", + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "People", + "blocks": [ + { + "type": "ListCollectorDrivingQuestion", + "id": "anyone-usually-live-at", + "for_list": "people", + "question": { + "type": "General", + "id": "anyone-usually-live-at-question", + "title": "Does anyone live at your address?", + "answers": [ + { + "type": "Radio", + "id": "anyone-usually-live-at-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-person", + "list_name": "people" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "list-collector" + } + ] + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": { + "text": "Change details for {first_name} {last_name}", + "placeholders": [ + { + "placeholder": "first_name", + "value": { + "source": "answers", + "identifier": "first-name" + } + }, + { + "placeholder": "last_name", + "value": { + "source": "answers", + "identifier": "last-name" + } + } + ] + }, + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "id": "another-anyone-usually-live-at", + "question": { + "answers": [ + { + "id": "another-anyone-usually-live-at-answer", + "mandatory": true, + "options": [ + { + "action": { + "params": { + "block_id": "another-add-person", + "list_name": "people" + }, + "type": "RedirectToListAddBlock" + }, + "label": "Yes", + "value": "Yes" + }, + { + "description": "For example, this is a second address or holiday home", + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "another-anyone-usually-live-at-question", + "title": "Does anyone else live at your address?", + "type": "General" + }, + "routing_rules": [ + { + "block": "another-list-collector" + } + ], + "type": "Question" + }, + { + "id": "another-list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "another-confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "another-anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "another-add-person", + "type": "ListAddQuestion", + "question": { + "id": "another-add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "another-edit-person", + "type": "ListEditQuestion", + "question": { + "id": "another-edit-question", + "type": "General", + "title": { + "text": "Change details for {first_name} {last_name}", + "placeholders": [ + { + "placeholder": "first_name", + "value": { + "source": "answers", + "identifier": "first-name" + } + }, + { + "placeholder": "last_name", + "value": { + "source": "answers", + "identifier": "last-name" + } + } + ] + }, + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "another-remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "another-remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "another-remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_list_collector_variants.json b/schemas/test/en/test_list_collector_variants.json new file mode 100644 index 0000000000..44d1975b70 --- /dev/null +++ b/schemas/test/en/test_list_collector_variants.json @@ -0,0 +1,385 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test ListCollector", + "theme": "default", + "description": "A questionnaire to test ListCollector", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": {} + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "type": "Question", + "id": "you-live-here-block", + "question": { + "type": "General", + "id": "you-live-here-question", + "title": "Do you live at 1 Pleasant Lane?", + "answers": [ + { + "type": "Radio", + "id": "you-live-here-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question_variants": [ + { + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live at 1 Pleasant Lane?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "you-live-here-answer" + }, + "Yes" + ] + } + }, + { + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone live at 1 Pleasant Lane?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "you-live-here-answer" + }, + "No" + ] + } + } + ], + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question_variants": [ + { + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person who isn’t you?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "you-live-here-answer" + }, + "No" + ] + } + }, + { + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "you-live-here-answer" + }, + "Yes" + ] + } + } + ] + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question_variants": [ + { + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "you-live-here-answer" + }, + "Yes" + ] + } + }, + { + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person who isn’t you?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "you-live-here-answer" + }, + "No" + ] + } + } + ] + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question_variants": [ + { + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "you-live-here-answer" + }, + "Yes" + ] + } + }, + { + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person who isn’t you?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "you-live-here-answer" + }, + "No" + ] + } + } + ] + }, + "summary": { + "title": "People who live here", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_list_collector_variants_primary_person.json b/schemas/test/en/test_list_collector_variants_primary_person.json new file mode 100644 index 0000000000..d4b7246a6d --- /dev/null +++ b/schemas/test/en/test_list_collector_variants_primary_person.json @@ -0,0 +1,368 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test PrimaryPersonListCollector With Variants", + "theme": "default", + "description": "A questionnaire to test Primary Person ListCollector with Variants", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "id": "group", + "title": "Variant Question", + "blocks": [ + { + "type": "Question", + "id": "variant-block", + "question": { + "type": "General", + "id": "variant-question", + "title": "Do you like variants?", + "answers": [ + { + "type": "Radio", + "id": "variant-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "id": "primary-person-list-collector", + "type": "PrimaryPersonListCollector", + "for_list": "people", + "add_or_edit_block": { + "id": "add-or-edit-primary-person", + "type": "PrimaryPersonListAddOrEditQuestion", + "question_variants": [ + { + "question": { + "id": "primary-person-add-or-edit-question", + "type": "General", + "title": "What is your name", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "variant-answer" + }, + "No" + ] + } + }, + { + "question": { + "id": "primary-person-add-or-edit-question", + "type": "General", + "title": "What is your name (variant)", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "variant-answer" + }, + "Yes" + ] + } + } + ] + }, + "question_variants": [ + { + "question": { + "id": "primary-confirmation-question", + "type": "General", + "title": "Do you live here? (variant)", + "answers": [ + { + "id": "you-live-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "variant-answer" + }, + "Yes" + ] + } + }, + { + "question": { + "id": "primary-confirmation-question", + "type": "General", + "title": "Do you live here?", + "answers": [ + { + "id": "you-live-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "variant-answer" + }, + "No" + ] + } + } + ] + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": { + "text": "Change details for {first_name} {last_name}", + "placeholders": [ + { + "placeholder": "first_name", + "value": { + "source": "answers", + "identifier": "first-name" + } + }, + { + "placeholder": "last_name", + "value": { + "source": "answers", + "identifier": "last-name" + } + } + ] + }, + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_list_collector_variants_section_summary.json b/schemas/test/en/test_list_collector_variants_section_summary.json new file mode 100644 index 0000000000..5b8ac29666 --- /dev/null +++ b/schemas/test/en/test_list_collector_variants_section_summary.json @@ -0,0 +1,551 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test List Collector Variants Section Summary Items", + "theme": "default", + "description": "A questionnaire to test list collector section summary items for variants", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section-companies", + "title": "General insurance business", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "companies", + "title": "Companies or UK branches", + "item_anchor_answer_id": "company-or-branch-name", + "item_label": "Name of UK or non-UK company or branch", + "add_link_text": "Add another UK company or branch", + "empty_list_text": "No UK company or branch added", + "related_answers": [ + { + "source": "answers", + "identifier": "registration-number" + }, + { + "source": "answers", + "identifier": "authorised-insurer-radio" + } + ] + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "group-companies", + "blocks": [ + { + "type": "Question", + "id": "uk-based-block", + "question": { + "type": "General", + "id": "uk-based-question", + "title": "Are the companies UK based?", + "answers": [ + { + "type": "Radio", + "id": "uk-based-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "type": "ListCollectorDrivingQuestion", + "id": "any-companies-or-branches", + "for_list": "companies", + "question": { + "type": "General", + "id": "any-companies-or-branches-question", + "title": "Do any companies or branches undertake general insurance business?", + "answers": [ + { + "type": "Radio", + "id": "any-companies-or-branches-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-company", + "list_name": "companies" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "confirmation-checkbox", + "when": { + "==": [ + { + "source": "answers", + "identifier": "any-companies-or-branches-answer" + }, + "No" + ] + } + }, + { + "block": "any-other-companies-or-branches" + } + ] + }, + { + "id": "any-other-companies-or-branches", + "type": "ListCollector", + "for_list": "companies", + "question_variants": [ + { + "question": { + "id": "any-other-companies-or-branches-question", + "type": "General", + "title": "Do you need to add any other UK companies or branches that undertake general insurance business?", + "answers": [ + { + "id": "any-other-companies-or-branches-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "uk-based-answer" + }, + "Yes" + ] + } + }, + { + "question": { + "id": "any-other-companies-or-branches-question", + "type": "General", + "title": "Do you need to add any other non-UK companies or branches that undertake general insurance business?", + "answers": [ + { + "id": "any-other-companies-or-branches-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "uk-based-answer" + }, + "No" + ] + } + } + ], + "add_block": { + "id": "add-company", + "type": "ListAddQuestion", + "question_variants": [ + { + "question": { + "id": "add-question-companies", + "type": "General", + "title": "Give details about the company or branch that undertakes general insurance business", + "answers": [ + { + "id": "company-or-branch-name", + "label": "Name of UK company or branch", + "mandatory": true, + "type": "TextField" + }, + { + "id": "registration-number", + "label": "UK Registration number", + "mandatory": true, + "type": "Number", + "maximum": { + "value": 999, + "exclusive": false + }, + "decimal_places": 0 + }, + { + "type": "Radio", + "label": "Is this UK company or branch an authorised insurer?", + "id": "authorised-insurer-radio", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "uk-based-answer" + }, + "Yes" + ] + } + }, + { + "question": { + "id": "add-question-companies", + "type": "General", + "title": "Give details about the company or branch that undertakes general insurance business", + "answers": [ + { + "id": "company-or-branch-name", + "label": "Name of non-UK company or branch", + "mandatory": true, + "type": "TextField" + }, + { + "id": "registration-number", + "label": "Non-UK Registration number", + "mandatory": true, + "type": "Number", + "maximum": { + "value": 999, + "exclusive": false + }, + "decimal_places": 0 + }, + { + "type": "Radio", + "label": "Is this non-UK company or branch an authorised insurer?", + "id": "authorised-insurer-radio", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "uk-based-answer" + }, + "No" + ] + } + } + ] + }, + "edit_block": { + "id": "edit-company", + "type": "ListEditQuestion", + "question_variants": [ + { + "question": { + "id": "edit-question-companies", + "type": "General", + "title": "What is the name of the company?", + "answers": [ + { + "id": "company-or-branch-name", + "label": "Name of UK company or branch", + "mandatory": true, + "type": "TextField" + }, + { + "id": "registration-number", + "label": "UK Registration number", + "mandatory": true, + "type": "Number" + }, + { + "type": "Radio", + "label": "Is this UK company or branch an authorised insurer?", + "id": "authorised-insurer-radio", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "uk-based-answer" + }, + "Yes" + ] + } + }, + { + "question": { + "id": "edit-question-companies", + "type": "General", + "title": "What is the name of the company?", + "answers": [ + { + "id": "company-or-branch-name", + "label": "Name of non-UK company or branch", + "mandatory": true, + "type": "TextField" + }, + { + "id": "registration-number", + "label": "Non-UK Registration number", + "mandatory": true, + "type": "Number" + }, + { + "type": "Radio", + "label": "Is this non-UK company or branch an authorised insurer?", + "id": "authorised-insurer-radio", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "uk-based-answer" + }, + "No" + ] + } + } + ] + }, + "remove_block": { + "id": "remove-company", + "type": "ListRemoveQuestion", + "question_variants": [ + { + "question": { + "id": "remove-question-companies", + "type": "General", + "title": "Are you sure you want to remove this company or non-UK branch?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "uk-based-answer" + }, + "No" + ] + } + }, + { + "question": { + "id": "remove-question-companies", + "type": "General", + "title": "Are you sure you want to remove this company or non-UK branch?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "uk-based-answer" + }, + "Yes" + ] + } + } + ] + }, + "summary": { + "title": "Companies or UK branches", + "item_title": { + "text": "{company_name}", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "answers", + "identifier": "company-or-branch-name" + } + } + ] + } + } + }, + { + "type": "Question", + "id": "confirmation-checkbox", + "question": { + "answers": [ + { + "id": "confirmation-checkbox-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "confirmation-checkbox-question", + "title": "Are all companies or branches based in UK?", + "type": "General" + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_list_summary_on_question.json b/schemas/test/en/test_list_summary_on_question.json new file mode 100644 index 0000000000..34c881ac18 --- /dev/null +++ b/schemas/test/en/test_list_summary_on_question.json @@ -0,0 +1,401 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test ListCollector", + "theme": "default", + "description": "A questionnaire to test ListCollector", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "title": "Who Lives Here", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": "Household members", + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + }, + { + "id": "extra-list-group", + "title": "Another List", + "blocks": [ + { + "id": "next-interstitial", + "content": { + "title": "Another list", + "contents": [ + { + "description": "You have added some people to the ‘people’ list. Next we’ll test another list collector adding to the same list. This should still have the same list of people." + } + ] + }, + "type": "Interstitial" + }, + { + "id": "another-list-collector-block", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "another-confirmation-question", + "type": "General", + "title": "This list collector will add to the same ‘people’ list. Add someone else?", + "answers": [ + { + "id": "another-anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "another-add-person", + "type": "ListAddQuestion", + "question": { + "id": "another-add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "another-edit-person", + "type": "ListEditQuestion", + "question": { + "id": "another-edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "another-remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "another-remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "another-remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "type": "Question", + "id": "radio-placeholder", + "question": { + "type": "General", + "id": "radio-placeholder-question", + "title": "Are any of these people related to one another?", + "answers": [ + { + "mandatory": false, + "type": "Radio", + "id": "radio-mandatory-answer", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No, all household members are unrelated", + "value": "No, all household members are unrelated" + } + ] + } + ] + }, + "list_summary": { + "for_list": "people", + "summary": { + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_markup.json b/schemas/test/en/test_markup.json new file mode 100644 index 0000000000..98bf348532 --- /dev/null +++ b/schemas/test/en/test_markup.json @@ -0,0 +1,74 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Markup test", + "theme": "default", + "description": "A questionnaire to test rendering of markup in questionnaires", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "markup-group", + "title": "Markup", + "blocks": [ + { + "type": "Question", + "id": "emphasis-block", + "question": { + "answers": [ + { + "guidance": { + "show_guidance": "Show lorem ipsum guidance", + "hide_guidance": "hide lorem ipsum guidance", + "contents": [ + { + "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit libero, a pharetra augue. Vestibulum id ligula porta felis euismod semper. Integer posuere erat a ante venenatis dapibus posuere velit aliquet." + } + ] + }, + "id": "answer", + "label": "What is the thing?", + "mandatory": false, + "type": "TextField" + } + ], + "description": [ + "Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur blandit tempus porttitor." + ], + "id": "question", + "title": "This is a title with emphasis", + "type": "General" + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_metadata_routing.json b/schemas/test/en/test_metadata_routing.json new file mode 100644 index 0000000000..1142d57f9e --- /dev/null +++ b/schemas/test/en/test_metadata_routing.json @@ -0,0 +1,117 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Household Schema", + "description": "Household Schema", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "boolean_flag", + "type": "boolean" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "group1", + "title": "Group 1", + "blocks": [ + { + "type": "Question", + "id": "block1", + "question": { + "id": "block1-question", + "title": "Question 1", + "type": "General", + "answers": [ + { + "id": "block1-answer", + "mandatory": false, + "type": "TextField", + "label": "Question 1" + } + ] + }, + "routing_rules": [ + { + "block": "block3", + "when": { + "==": [ + { + "identifier": "boolean_flag", + "source": "metadata" + }, + true + ] + } + }, + { + "block": "block2" + } + ] + }, + { + "type": "Question", + "id": "block2", + "question": { + "id": "block2-question", + "title": "Question 2", + "type": "General", + "answers": [ + { + "id": "block2-answer", + "mandatory": false, + "type": "TextField", + "label": "Question 2" + } + ] + } + }, + { + "type": "Question", + "id": "block3", + "question": { + "id": "block3-question", + "title": "Question 3", + "type": "General", + "answers": [ + { + "id": "block3-answer", + "mandatory": false, + "type": "TextField", + "label": "Question 3" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_mobile_number.json b/schemas/test/en/test_mobile_number.json new file mode 100644 index 0000000000..1b02b83758 --- /dev/null +++ b/schemas/test/en/test_mobile_number.json @@ -0,0 +1,61 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test mobile number", + "theme": "default", + "description": "A questionnaire to test a mobile number", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "mobile-number-block", + "question": { + "answers": [ + { + "id": "mobile-number-answer", + "label": "UK mobile Number", + "mandatory": true, + "type": "MobileNumber" + } + ], + "id": "mobile-number-question", + "title": "What is your mobile number?", + "type": "General" + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_multiple_answers.json b/schemas/test/en/test_multiple_answers.json new file mode 100644 index 0000000000..6f1832cdac --- /dev/null +++ b/schemas/test/en/test_multiple_answers.json @@ -0,0 +1,217 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "023", + "title": "Multiple answers per question", + "description": "A questionnaire containing questions which have more than one answer", + "theme": "default", + "legal_basis": "Notice is given under section 1 of the Statistics of Trade Act 1947.", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "about-you-block", + "question": { + "id": "about-you-question", + "title": "About You", + "type": "General", + "answers": [ + { + "id": "textfield-answer", + "type": "TextField", + "mandatory": true, + "label": "Your name" + }, + { + "id": "date-answer", + "type": "Date", + "mandatory": true, + "label": "What is your date of birth?" + }, + { + "id": "checkbox-answer", + "type": "Checkbox", + "mandatory": true, + "label": "What are your favourite car brands?", + "instruction": "Select your favourite car brands", + "options": [ + { + "label": "BMW", + "value": "BMW" + }, + { + "label": "Mercedes", + "value": "Mercedes" + }, + { + "label": "Audi", + "value": "Audi" + }, + { + "label": "None of the above", + "value": "None of the above" + } + ] + }, + { + "id": "radio-answer", + "type": "Radio", + "mandatory": true, + "label": "Would you like the sports package?", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + }, + { + "id": "currency-answer", + "type": "Currency", + "currency": "GBP", + "mandatory": true, + "label": "What is your budget?", + "decimal_places": 2 + }, + { + "id": "month-year-date-answer", + "type": "MonthYearDate", + "mandatory": true, + "label": "When would you like the car by?" + }, + { + "id": "dropdown-answer", + "type": "Dropdown", + "mandatory": true, + "label": "Select a colour", + "options": [ + { + "label": "Blue", + "value": "Blue" + }, + { + "label": "Silver", + "value": "Silver" + }, + { + "label": "Black", + "value": "Black" + } + ] + }, + { + "id": "unit-answer", + "type": "Unit", + "unit": "length-mile", + "unit_length": "short", + "mandatory": true, + "label": "Max mileage" + }, + { + "id": "duration-answer", + "type": "Duration", + "units": ["years", "months"], + "mandatory": true, + "label": "How long have you had your licence?" + }, + { + "id": "year-date-answer", + "type": "YearDate", + "mandatory": true, + "label": "Which year did you get your licence?" + }, + { + "id": "number-answer", + "type": "Number", + "mandatory": true, + "label": "How many seats?" + }, + { + "id": "percentage-answer", + "type": "Percentage", + "mandatory": true, + "label": "Max CO2 emissions" + }, + { + "id": "mobile-number-answer", + "type": "MobileNumber", + "mandatory": true, + "label": "What is your mobile number?" + }, + { + "id": "textarea-answer", + "type": "TextArea", + "mandatory": true, + "label": "Other comments" + } + ] + } + }, + { + "type": "Question", + "id": "age-block", + "question": { + "id": "age-question", + "title": "How old are you?", + "type": "General", + "answers": [ + { + "id": "age-answer", + "type": "Number", + "mandatory": true, + "label": "Your age" + }, + { + "id": "age-estimate-answer", + "type": "Checkbox", + "mandatory": true, + "instruction": "Estimate", + "options": [ + { + "label": "This age is an estimate", + "value": "This age is an estimate" + } + ] + } + ] + } + } + ], + "id": "default-group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_multiple_piping.json b/schemas/test/en/test_multiple_piping.json new file mode 100644 index 0000000000..a7e56dbb94 --- /dev/null +++ b/schemas/test/en/test_multiple_piping.json @@ -0,0 +1,244 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Multiple piping test survey", + "theme": "default", + "description": "A questionnaire to test multiple piping into a question and answer", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "what-is-your-address-group", + "title": "What is your address?", + "blocks": [ + { + "type": "Question", + "id": "what-is-your-address", + "question": { + "id": "what-is-your-address-question", + "title": "What is your address?", + "type": "General", + "answers": [ + { + "id": "building", + "label": "Building", + "mandatory": false, + "type": "TextField" + }, + { + "id": "address-line-1", + "label": "Address Line 1", + "mandatory": true, + "type": "TextField", + "validation": { + "messages": { + "MANDATORY_TEXTFIELD": "Enter an address to continue" + } + } + }, + { + "id": "address-line-2", + "label": "Address Line 2", + "mandatory": false, + "type": "TextField" + }, + { + "id": "address-line-3", + "label": "Address Line 3", + "mandatory": false, + "type": "TextField" + }, + { + "id": "town-city", + "label": "Town/City", + "mandatory": false, + "type": "TextField" + }, + { + "id": "county", + "label": "County", + "mandatory": false, + "type": "TextField" + }, + { + "id": "postcode", + "label": "Postcode", + "mandatory": false, + "type": "TextField" + }, + { + "id": "country", + "label": "Country", + "mandatory": false, + "type": "TextField" + } + ] + } + }, + { + "type": "Question", + "id": "textfield", + "question": { + "id": "textfield-question", + "title": "Enter text below", + "type": "General", + "answers": [ + { + "id": "first-text", + "label": "Enter Name 1", + "mandatory": true, + "type": "TextField", + "validation": { + "messages": { + "MANDATORY_TEXTFIELD": "Please enter text?" + } + } + }, + { + "id": "second-text", + "label": "Enter Name 2", + "mandatory": false, + "type": "TextField" + } + ] + } + }, + { + "type": "Question", + "id": "piping-question", + "question": { + "id": "multiple-piping-question", + "title": { + "text": "Does {person} live at {address}", + "placeholders": [ + { + "placeholder": "person", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-text" + }, + { + "source": "answers", + "identifier": "second-text" + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "address", + "value": { + "source": "answers", + "identifier": "address-line-1" + } + } + ] + }, + "type": "General", + "answers": [ + { + "id": "multiple-piping-answer", + "type": "Radio", + "mandatory": true, + "options": [ + { + "label": { + "text": "{address}", + "placeholders": [ + { + "placeholder": "address", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "building" + }, + { + "source": "answers", + "identifier": "address-line-1" + }, + { + "source": "answers", + "identifier": "address-line-2" + }, + { + "source": "answers", + "identifier": "address-line-3" + }, + { + "source": "answers", + "identifier": "town-city" + }, + { + "source": "answers", + "identifier": "county" + }, + { + "source": "answers", + "identifier": "postcode" + }, + { + "source": "answers", + "identifier": "country" + } + ], + "delimiter": ", " + } + } + ] + } + ] + }, + "value": "{address}" + }, + { + "label": "at another address", + "value": "at another address" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_mutually_exclusive.json b/schemas/test/en/test_mutually_exclusive.json new file mode 100644 index 0000000000..e691163842 --- /dev/null +++ b/schemas/test/en/test_mutually_exclusive.json @@ -0,0 +1,573 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Mutually Exclusive", + "theme": "default", + "description": "A questionnaire to demo mutually exclusive answers with single checkbox override", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": true + } + } + }, + "sections": [ + { + "id": "mutually-exclusive-checkbox-section", + "title": "Checkbox", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-mandatory-group", + "title": "Mutually Exclusive With Single Checkbox Override - Mandatory", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-checkbox", + "question": { + "id": "mutually-exclusive-checkbox-question", + "type": "MutuallyExclusive", + "title": "What is your nationality?", + "warning": "This is important", + "mandatory": true, + "answers": [ + { + "id": "checkbox-answer", + "instruction": "Select an answer", + "type": "Checkbox", + "mandatory": false, + "options": [ + { + "label": "British", + "value": "British" + }, + { + "label": "Irish", + "value": "Irish" + }, + { + "label": "Other", + "description": "Enter another Nationality", + "value": "Other", + "detail_answer": { + "mandatory": false, + "id": "checkbox-child-other-answer", + "label": "Please specify other", + "type": "TextField" + } + } + ] + }, + { + "id": "checkbox-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "description": "Some description", + "value": "I prefer not to say" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-mandatory-date-section", + "title": "Date", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-mandatory-date-group", + "title": "Mutually Exclusive With Single Checkbox Override - Mandatory", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-mandatory-date", + "question": { + "id": "mutually-exclusive-mandatory-date-question", + "type": "MutuallyExclusive", + "title": "When did you leave your last paid job?", + "mandatory": true, + "answers": [ + { + "id": "mandatory-date-answer", + "label": "Enter a date", + "mandatory": false, + "type": "Date" + }, + { + "id": "mandatory-date-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-date-section", + "title": "Date", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-date-group", + "title": "Mutually Exclusive With Single Checkbox Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-date", + "question": { + "id": "mutually-exclusive-date-question", + "type": "MutuallyExclusive", + "title": "When did you leave your last paid job?", + "mandatory": false, + "answers": [ + { + "id": "date-answer", + "label": "Enter a date", + "mandatory": false, + "type": "Date" + }, + { + "id": "date-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-currency-section", + "title": "Currency", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-currency-group", + "title": "Mutually Exclusive With Single Checkbox Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-currency", + "question": { + "id": "mutually-exclusive-currency-question", + "type": "MutuallyExclusive", + "title": "What is your annual income before tax?", + "mandatory": false, + "answers": [ + { + "id": "currency-answer", + "label": "Enter your income", + "mandatory": false, + "type": "Currency", + "currency": "GBP" + }, + { + "id": "currency-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-number-section", + "title": "Number", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-number-group", + "title": "Mutually Exclusive With Single Checkbox Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-number", + "question": { + "id": "mutually-exclusive-number-question", + "type": "MutuallyExclusive", + "title": "What is your favourite number?", + "mandatory": false, + "answers": [ + { + "id": "number-answer", + "label": "Enter your favourite number", + "mandatory": false, + "type": "Number", + "decimal_places": 2 + }, + { + "id": "number-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-percentage-section", + "title": "Percentage", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-percentage-group", + "title": "Mutually Exclusive With Single Checkbox Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-percentage", + "question": { + "id": "mutually-exclusive-percentage-question", + "type": "MutuallyExclusive", + "title": "What was the percentage increase in your annual income this tax year?", + "mandatory": false, + "answers": [ + { + "id": "percentage-answer", + "label": "Enter the percentage increase of your income", + "mandatory": false, + "type": "Percentage", + "maximum": { + "value": 100 + } + }, + { + "id": "percentage-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-textfield-section", + "title": "Textfield", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-textfield-group", + "title": "Mutually Exclusive With Single Checkbox Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-textfield", + "question": { + "id": "mutually-exclusive-textfield-question", + "type": "MutuallyExclusive", + "title": "What is your favourite colour?", + "mandatory": false, + "answers": [ + { + "id": "textfield-answer", + "label": "Enter your favourite colour", + "mandatory": false, + "type": "TextField" + }, + { + "id": "textfield-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-month-year-date-section", + "title": "Month Year Date", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-month-year-date-group", + "title": "Mutually Exclusive With Single Checkbox Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-month-year-date", + "question": { + "id": "mutually-exclusive-month-year-date-question", + "type": "MutuallyExclusive", + "title": "When did you leave your last paid job?", + "mandatory": false, + "answers": [ + { + "id": "month-year-date-answer", + "label": "Enter a date", + "mandatory": false, + "type": "MonthYearDate", + "maximum": { + "value": "now" + } + }, + { + "id": "month-year-date-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-year-date-section", + "title": "Year Date", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-year-date-group", + "title": "Mutually Exclusive With Single Checkbox Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-year-date", + "question": { + "id": "mutually-exclusive-year-date-question", + "type": "MutuallyExclusive", + "title": "When did you leave your last paid job?", + "mandatory": false, + "answers": [ + { + "id": "year-date-answer", + "label": "Enter a date", + "mandatory": false, + "type": "YearDate", + "maximum": { + "value": "now" + } + }, + { + "id": "year-date-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-unit-section", + "title": "Unit", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-unit-group", + "title": "Mutually Exclusive With Single Checkbox Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-unit", + "question": { + "id": "mutually-exclusive-unit-question", + "type": "MutuallyExclusive", + "title": "How many years have you been in the UK?", + "mandatory": false, + "answers": [ + { + "id": "unit-answer", + "label": "Enter the number of years you have lived in the UK", + "unit": "duration-year", + "type": "Unit", + "unit_length": "long", + "mandatory": false + }, + { + "id": "unit-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-duration-section", + "title": "Duration", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-duration-group", + "title": "Mutually Exclusive With Single Checkbox Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-duration", + "question": { + "id": "mutually-exclusive-duration-question", + "type": "MutuallyExclusive", + "title": "How long have you been employed for?", + "mandatory": false, + "answers": [ + { + "id": "duration-answer", + "mandatory": false, + "units": ["years", "months"], + "type": "Duration" + }, + { + "id": "duration-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-textarea-section", + "title": "TextArea", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-textarea-group", + "title": "Mutually Exclusive With Single Checkbox Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-textarea", + "question": { + "id": "mutually-exclusive-textarea-question", + "type": "MutuallyExclusive", + "title": "Why did you leave your last job?", + "mandatory": false, + "answers": [ + { + "id": "textarea-answer", + "mandatory": false, + "type": "TextArea" + }, + { + "id": "textarea-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_mutually_exclusive_multiple.json b/schemas/test/en/test_mutually_exclusive_multiple.json new file mode 100644 index 0000000000..a4603cc5a2 --- /dev/null +++ b/schemas/test/en/test_mutually_exclusive_multiple.json @@ -0,0 +1,622 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Mutually Exclusive Multiple", + "theme": "default", + "description": "A questionnaire to demo mutually exclusive answers with multiple radio override", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": true + } + } + }, + "sections": [ + { + "id": "mutually-exclusive-checkbox-section", + "title": "Checkbox", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-checkbox-mandatory-group", + "title": "Mutually Exclusive With Multiple Radio Override - Mandatory", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-checkbox", + "question": { + "id": "mutually-exclusive-checkbox-question", + "type": "MutuallyExclusive", + "title": "What is your nationality?", + "warning": "This is important", + "mandatory": true, + "answers": [ + { + "id": "checkbox-answer", + "instruction": "Select an answer", + "type": "Checkbox", + "mandatory": false, + "options": [ + { + "label": "British", + "value": "British" + }, + { + "label": "Irish", + "value": "Irish" + }, + { + "label": "Other", + "description": "Enter another Nationality", + "value": "Other", + "detail_answer": { + "mandatory": false, + "id": "checkbox-child-other-answer", + "label": "Please specify other", + "type": "TextField" + } + } + ] + }, + { + "id": "checkbox-exclusive-answer", + "mandatory": false, + "type": "Radio", + "options": [ + { + "label": "I prefer not to say", + "description": "Some description", + "value": "I prefer not to say" + }, + { + "label": "I am an alien", + "description": "Some description", + "value": "I am an alien" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-mandatory-date-section", + "title": "Date", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-mandatory-date-group", + "title": "Mutually Exclusive With Multiple Radio Override - Mandatory", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-mandatory-date", + "question": { + "id": "mutually-exclusive-mandatory-date-question", + "type": "MutuallyExclusive", + "title": "When did you leave your last paid job?", + "mandatory": true, + "answers": [ + { + "id": "mandatory-date-answer", + "label": "Enter a date", + "mandatory": false, + "type": "Date" + }, + { + "id": "mandatory-date-exclusive-answer", + "mandatory": false, + "type": "Radio", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + }, + { + "label": "I have never worked", + "value": "I have never worked" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-date-section", + "title": "Date", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-date-group", + "title": "Mutually Exclusive With Multiple Radio Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-date", + "question": { + "id": "mutually-exclusive-date-question", + "type": "MutuallyExclusive", + "title": "When did you leave your last paid job?", + "mandatory": false, + "answers": [ + { + "id": "date-answer", + "label": "Enter a date", + "mandatory": false, + "type": "Date" + }, + { + "id": "date-exclusive-answer", + "mandatory": false, + "type": "Radio", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + }, + { + "label": "I have never worked", + "value": "I have never worked" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-currency-section", + "title": "Currency", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-currency-group", + "title": "Mutually Exclusive With Multiple Radio Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-currency", + "question": { + "id": "mutually-exclusive-currency-question", + "type": "MutuallyExclusive", + "title": "What is your annual income before tax?", + "mandatory": false, + "answers": [ + { + "id": "currency-answer", + "label": "Enter your income", + "mandatory": false, + "type": "Currency", + "currency": "GBP" + }, + { + "id": "currency-exclusive-answer", + "mandatory": false, + "type": "Radio", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + }, + { + "label": "I have no income", + "value": "I have no income" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-number-section", + "title": "Number", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-number-group", + "title": "Mutually Exclusive With Multiple Radio Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-number", + "question": { + "id": "mutually-exclusive-number-question", + "type": "MutuallyExclusive", + "title": "What is your favourite number?", + "mandatory": false, + "answers": [ + { + "id": "number-answer", + "label": "Enter your favourite number", + "mandatory": false, + "type": "Number", + "decimal_places": 2 + }, + { + "id": "number-exclusive-answer", + "mandatory": false, + "type": "Radio", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + }, + { + "label": "I dont have a favourite number", + "value": "I dont have a favourite number" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-percentage-section", + "title": "Percentage", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-percentage-group", + "title": "Mutually Exclusive With Multiple Radio Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-percentage", + "question": { + "id": "mutually-exclusive-percentage-question", + "type": "MutuallyExclusive", + "title": "What was the percentage increase in your annual income this tax year?", + "mandatory": false, + "answers": [ + { + "id": "percentage-answer", + "label": "Enter the percentage increase of your income", + "mandatory": false, + "type": "Percentage", + "maximum": { + "value": 100 + } + }, + { + "id": "percentage-exclusive-answer", + "mandatory": false, + "type": "Radio", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + }, + { + "label": "No income change", + "value": "No income change" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-textfield-section", + "title": "Textfield", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-textfield-group", + "title": "Mutually Exclusive With Multiple Radio Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-textfield", + "question": { + "id": "mutually-exclusive-textfield-question", + "type": "MutuallyExclusive", + "title": "What is your favourite colour?", + "mandatory": false, + "answers": [ + { + "id": "textfield-answer", + "label": "Enter your favourite colour", + "mandatory": false, + "type": "TextField" + }, + { + "id": "textfield-exclusive-answer", + "mandatory": false, + "type": "Radio", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + }, + { + "label": "I dont have a favorite colour", + "value": "I dont have a favorite colour" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-month-year-date-section", + "title": "Month Year Date", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-month-year-date-group", + "title": "Mutually Exclusive With Multiple Radio Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-month-year-date", + "question": { + "id": "mutually-exclusive-month-year-date-question", + "type": "MutuallyExclusive", + "title": "When did you leave your last paid job?", + "mandatory": false, + "answers": [ + { + "id": "month-year-date-answer", + "label": "Enter a date", + "mandatory": false, + "type": "MonthYearDate", + "maximum": { + "value": "now" + } + }, + { + "id": "month-year-date-exclusive-answer", + "mandatory": false, + "type": "Radio", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + }, + { + "label": "I have never worked", + "value": "I have never worked" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-year-date-section", + "title": "Year Date", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-year-date-group", + "title": "Mutually Exclusive With Multiple Radio Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-year-date", + "question": { + "id": "mutually-exclusive-year-date-question", + "type": "MutuallyExclusive", + "title": "When did you leave your last paid job?", + "mandatory": false, + "answers": [ + { + "id": "year-date-answer", + "label": "Enter a date", + "mandatory": false, + "type": "YearDate", + "maximum": { + "value": "now" + } + }, + { + "id": "year-date-exclusive-answer", + "mandatory": false, + "type": "Radio", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + }, + { + "label": "I have never worked", + "value": "I have never worked" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-unit-section", + "title": "Unit", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-unit-group", + "title": "Mutually Exclusive With Multiple Radio Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-unit", + "question": { + "id": "mutually-exclusive-unit-question", + "type": "MutuallyExclusive", + "title": "How many years have you been in the UK?", + "mandatory": false, + "answers": [ + { + "id": "unit-answer", + "label": "Enter the number of years you have lived in the UK", + "unit": "duration-year", + "type": "Unit", + "unit_length": "long", + "mandatory": false + }, + { + "id": "unit-exclusive-answer", + "mandatory": false, + "type": "Radio", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + }, + { + "label": "I have never lived in the UK", + "value": "I have never lived in the UK" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-duration-section", + "title": "Duration", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-duration-group", + "title": "Mutually Exclusive With Multiple Radio Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-duration", + "question": { + "id": "mutually-exclusive-duration-question", + "type": "MutuallyExclusive", + "title": "How long have you been employed for?", + "mandatory": false, + "answers": [ + { + "id": "duration-answer", + "mandatory": false, + "units": ["years", "months"], + "type": "Duration" + }, + { + "id": "duration-exclusive-answer", + "mandatory": false, + "type": "Radio", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + }, + { + "label": "I have never worked", + "value": "I have never worked" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "mutually-exclusive-textarea-section", + "title": "TextArea", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "mutually-exclusive-textarea-group", + "title": "Mutually Exclusive With Multiple Radio Override - Optional", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-textarea", + "question": { + "id": "mutually-exclusive-textarea-question", + "type": "MutuallyExclusive", + "title": "Why did you leave your last job?", + "mandatory": false, + "answers": [ + { + "id": "textarea-answer", + "mandatory": false, + "type": "TextArea" + }, + { + "id": "textarea-exclusive-answer", + "mandatory": false, + "type": "Radio", + "options": [ + { + "label": "I prefer not to say", + "value": "I prefer not to say" + }, + { + "label": "I have never worked", + "value": "I have never worked" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_new_calculated_summary.json b/schemas/test/en/test_new_calculated_summary.json new file mode 100644 index 0000000000..9e10f5cd04 --- /dev/null +++ b/schemas/test/en/test_new_calculated_summary.json @@ -0,0 +1,571 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "A test schema to demo Calculated Summary", + "theme": "default", + "description": "A schema to showcase Calculated Summary pages and usage in value source.", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "group", + "title": "Total a range of values", + "blocks": [ + { + "type": "Question", + "id": "first-number-block", + "question": { + "id": "first-number-question", + "title": "First Number Question Title", + "type": "General", + "answers": [ + { + "id": "first-number-answer", + "label": "First answer label", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "minimum": { + "value": -1000, + "exclusive": false + } + } + ] + } + }, + { + "type": "Question", + "id": "second-number-block", + "question": { + "id": "second-number-question", + "title": "Second Number Question Title", + "type": "General", + "answers": [ + { + "id": "second-number-answer", + "label": "Second answer in currency label", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "minimum": { + "value": -1000, + "exclusive": false + } + }, + { + "id": "second-number-answer-unit-total", + "label": "Second answer label in unit total", + "mandatory": true, + "type": "Unit", + "unit_length": "short", + "unit": "length-centimeter" + }, + { + "id": "second-number-answer-also-in-total", + "label": "Second answer label also in currency total (optional)", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "minimum": { + "value": -1000, + "exclusive": false + } + } + ] + } + }, + { + "type": "Question", + "id": "third-number-block", + "question": { + "id": "third-number-question", + "title": "Third Number Question Title", + "type": "General", + "answers": [ + { + "id": "third-number-answer", + "label": "Third answer label", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "minimum": { + "value": -1000, + "exclusive": false + } + } + ] + } + }, + { + "type": "Question", + "id": "third-and-a-half-number-block", + "question": { + "id": "third-and-a-half-number-question-unit-total", + "title": "Third Number Question Title Unit Total", + "type": "General", + "answers": [ + { + "id": "third-and-a-half-number-answer-unit-total", + "label": "Third answer label in unit total", + "mandatory": true, + "type": "Unit", + "unit_length": "short", + "unit": "length-centimeter" + } + ] + } + }, + { + "type": "Question", + "id": "skip-fourth-block", + "question": { + "type": "General", + "id": "skip-fourth-block-question", + "title": "Skip Fourth Block so it doesn’t appear in Total?", + "answers": [ + { + "type": "Radio", + "id": "skip-fourth-block-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "skip-fourth-block-answer", + "source": "answers" + }, + "Yes" + ] + } + }, + "type": "Question", + "id": "fourth-number-block", + "question": { + "id": "fourth-number-question", + "title": "Fourth Number Question Title", + "type": "General", + "answers": [ + { + "id": "fourth-number-answer", + "label": "Fourth answer label (optional)", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "skip-fourth-block-answer", + "source": "answers" + }, + "Yes" + ] + } + }, + "type": "Question", + "id": "fourth-and-a-half-number-block", + "question": { + "id": "fourth-and-a-half-number-question-also-in-total", + "title": "Fourth Number Additional Question Title", + "type": "General", + "answers": [ + { + "id": "fourth-and-a-half-number-answer-also-in-total", + "label": "Fourth answer label also in total (optional)", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "fifth-number-block", + "question": { + "id": "fifth-number-question", + "title": "Fifth Number Question Title Percentage", + "type": "General", + "answers": [ + { + "id": "fifth-percent-answer", + "label": "Fifth answer label percentage total", + "mandatory": true, + "type": "Percentage", + "maximum": { + "value": 100 + } + }, + { + "id": "fifth-number-answer", + "label": "Fifth answer label number total", + "mandatory": false, + "type": "Number", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "sixth-number-block", + "question": { + "id": "sixth-number-question", + "title": "Sixth Number Question Title Percentage", + "type": "General", + "answers": [ + { + "id": "sixth-percent-answer", + "label": "Sixth answer label percentage total", + "mandatory": true, + "type": "Percentage", + "maximum": { + "value": 100 + } + }, + { + "id": "sixth-number-answer", + "label": "Sixth answer label number total", + "mandatory": false, + "type": "Number", + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "currency-total-playback", + "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "first-number-answer" + }, + { + "source": "answers", + "identifier": "second-number-answer" + }, + { + "source": "answers", + "identifier": "second-number-answer-also-in-total" + }, + { + "source": "answers", + "identifier": "third-number-answer" + }, + { + "source": "answers", + "identifier": "fourth-number-answer" + }, + { + "source": "answers", + "identifier": "fourth-and-a-half-number-answer-also-in-total" + } + ] + }, + "title": "Grand total of previous values" + } + }, + { + "type": "CalculatedSummary", + "id": "unit-total-playback", + "title": "We calculate the total of unit values entered to be %(total)s. Is this correct?", + "page_title": "Total Unit Values", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "second-number-answer-unit-total" + }, + { + "source": "answers", + "identifier": "third-and-a-half-number-answer-unit-total" + } + ] + }, + "title": "Grand total of previous values" + } + }, + { + "type": "CalculatedSummary", + "id": "percentage-total-playback", + "title": "We calculate the total of percentage values entered to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "fifth-percent-answer" + }, + { + "source": "answers", + "identifier": "sixth-percent-answer" + } + ] + }, + "title": "Grand total of previous values" + } + }, + { + "type": "CalculatedSummary", + "id": "number-total-playback", + "title": "We calculate the total of number values entered to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "fifth-number-answer" + }, + { + "source": "answers", + "identifier": "sixth-number-answer" + } + ] + }, + "title": "Grand total of previous values" + } + }, + { + "type": "Interstitial", + "id": "calculated-summary-total-confirmation", + "content": { + "title": "You have provided the following grand totals.", + "contents": [ + { + "list": [ + { + "text": "Total currency values: {currency_total}", + "placeholders": [ + { + "placeholder": "currency_total", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "source": "calculated_summary", + "identifier": "currency-total-playback" + } + } + } + ] + } + ] + }, + { + "text": "Total unformatted unit values: {unit_total}", + "placeholders": [ + { + "placeholder": "unit_total", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "calculated_summary", + "identifier": "unit-total-playback" + } + } + } + ] + } + ] + }, + { + "text": "Total formatted unit values: {unit_total}", + "placeholders": [ + { + "placeholder": "unit_total", + "transforms": [ + { + "transform": "format_unit", + "arguments": { + "value": { + "source": "calculated_summary", + "identifier": "unit-total-playback" + }, + "unit": "length-centimeter", + "unit_length": "short" + } + } + ] + } + ] + }, + { + "text": "Total unformatted percentage values: {percentage_total}", + "placeholders": [ + { + "placeholder": "percentage_total", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "calculated_summary", + "identifier": "percentage-total-playback" + } + } + } + ] + } + ] + }, + { + "text": "Total formatted percentage values: {percentage_total}", + "placeholders": [ + { + "placeholder": "percentage_total", + "transforms": [ + { + "transform": "format_percentage", + "arguments": { + "value": { + "source": "calculated_summary", + "identifier": "percentage-total-playback" + } + } + } + ] + } + ] + }, + { + "text": "Total number values: {number_total}", + "placeholders": [ + { + "placeholder": "number_total", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "calculated_summary", + "identifier": "number-total-playback" + } + } + } + ] + } + ] + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "set-min-max-block", + "question": { + "answers": [ + { + "id": "set-minimum-answer", + "label": "Set a value greater than the total above", + "mandatory": true, + "description": "This is a description of the minimum value", + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "minimum": { + "value": { + "source": "calculated_summary", + "identifier": "currency-total-playback" + } + } + }, + { + "id": "set-maximum-answer", + "description": "This is a description of the maximum value", + "label": "Set a value less than the total above", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "maximum": { + "value": { + "source": "calculated_summary", + "identifier": "currency-total-playback" + } + } + } + ], + "id": "set-min-question", + "title": { + "placeholders": [ + { + "placeholder": "calculated_summary_answer", + "value": { + "identifier": "currency-total-playback", + "source": "calculated_summary" + } + } + ], + "text": "Set minimum and maximum values based on your calculated summary total of £{calculated_summary_answer}" + }, + "type": "General" + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_new_calculated_summary_cross_section_dependencies.json b/schemas/test/en/test_new_calculated_summary_cross_section_dependencies.json new file mode 100644 index 0000000000..d79882b3d1 --- /dev/null +++ b/schemas/test/en/test_new_calculated_summary_cross_section_dependencies.json @@ -0,0 +1,375 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Calculated Summary Cross Section Dependencies", + "theme": "default", + "description": "A questionnaire to demo resolution of calculated summary values across sections", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "questions-section", + "title": "Questions", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "radio", + "title": "Questions", + "blocks": [ + { + "type": "Question", + "id": "skip-first-block", + "question": { + "type": "General", + "id": "skip-first-block-question", + "title": "Skip First Block so it doesn’t appear in Total?", + "answers": [ + { + "type": "Radio", + "id": "skip-first-block-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "skip-first-block-answer", + "source": "answers" + }, + "Yes" + ] + } + }, + "type": "Question", + "id": "first-number-block", + "question": { + "id": "first-number-question", + "title": "First Number Question Title", + "type": "General", + "answers": [ + { + "id": "first-number-answer", + "label": "First answer label (optional)", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "skip-first-block-answer", + "source": "answers" + }, + "Yes" + ] + } + }, + "type": "Question", + "id": "first-and-a-half-number-block", + "question": { + "id": "first-and-a-half-number-question-also-in-total", + "title": "First Number Additional Question Title", + "type": "General", + "answers": [ + { + "id": "first-and-a-half-number-answer-also-in-total", + "label": "First answer label also in total (optional)", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "second-number-block", + "question": { + "id": "second-number-question-also-in-total", + "title": "Second Number Additional Question Title", + "type": "General", + "answers": [ + { + "id": "second-number-answer-also-in-total", + "label": "Second answer label also in total (optional)", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "currency-total-playback-1", + "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "first-number-answer" + }, + { + "source": "answers", + "identifier": "first-and-a-half-number-answer-also-in-total" + }, + { + "source": "answers", + "identifier": "second-number-answer-also-in-total" + } + ] + }, + "title": "Grand total of previous values" + } + } + ] + } + ] + }, + { + "id": "calculated-summary-section", + "title": "Calculated Summary", + "summary": { "show_on_completion": true }, + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "third-number-block", + "question": { + "id": "third-number-question", + "title": "Third Number Question Title", + "type": "General", + "answers": [ + { + "id": "third-number-answer", + "label": "Third answer in currency label", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "third-number-answer-also-in-total", + "label": "Third answer label also in currency total (optional)", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "currency-total-playback-2", + "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "third-number-answer" + }, + { + "source": "answers", + "identifier": "third-number-answer-also-in-total" + } + ] + }, + "title": "Grand total of previous values" + } + }, + { + "type": "Question", + "id": "mutually-exclusive-checkbox", + "question": { + "id": "mutually-exclusive-checkbox-question", + "type": "MutuallyExclusive", + "title": "Which answer did you give to question 4 and a half?", + "mandatory": true, + "answers": [ + { + "id": "checkbox-answer", + "instruction": "Select an answer", + "type": "Checkbox", + "mandatory": false, + "options": [ + { + "label": { + "placeholders": [ + { + "placeholder": "answer_value_1", + "value": { + "identifier": "first-and-a-half-number-answer-also-in-total", + "source": "answers" + } + } + ], + "text": "{answer_value_1} - first and a half answer" + }, + "value": "{answer_value_1}" + }, + { + "label": { + "placeholders": [ + { + "placeholder": "calc_value_1", + "value": { + "identifier": "currency-total-playback-1", + "source": "calculated_summary" + } + } + ], + "text": "{calc_value_1} - calculated summary answer (previous section)" + }, + "value": "{calc_value_1}" + }, + { + "label": { + "placeholders": [ + { + "placeholder": "calc_value_2", + "value": { + "identifier": "currency-total-playback-2", + "source": "calculated_summary" + } + } + ], + "text": "{calc_value_2} - calculated summary answer (current section)" + }, + "value": "{calc_value_2}" + }, + { + "label": { + "placeholders": [ + { + "placeholder": "third_answer_value", + "value": { + "identifier": "third-number-answer", + "source": "answers" + } + } + ], + "text": "{third_answer_value} - third answer" + }, + "value": "{third_answer_value}" + } + ] + }, + { + "id": "checkbox-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "description": "Some description", + "value": "I prefer not to say" + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "set-min-max-block", + "question": { + "answers": [ + { + "id": "set-minimum-answer", + "label": "Set a value greater than the total above", + "mandatory": true, + "description": "This is a description of the minimum value", + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "minimum": { + "value": { + "source": "calculated_summary", + "identifier": "currency-total-playback-1" + } + } + }, + { + "id": "set-maximum-answer", + "description": "This is a description of the maximum value", + "label": "Set a value less than the total above", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "maximum": { + "value": { + "source": "calculated_summary", + "identifier": "currency-total-playback-1" + } + } + } + ], + "id": "set-min-question", + "title": { + "placeholders": [ + { + "placeholder": "calculated_summary_answer", + "value": { + "identifier": "currency-total-playback-1", + "source": "calculated_summary" + } + } + ], + "text": "Set minimum and maximum values based on your calculated summary total of £{calculated_summary_answer}" + }, + "type": "General" + } + } + ], + "id": "calculated-summary" + } + ] + } + ] +} diff --git a/schemas/test/en/test_new_calculated_summary_cross_section_dependencies_repeating.json b/schemas/test/en/test_new_calculated_summary_cross_section_dependencies_repeating.json new file mode 100644 index 0000000000..5bfb54b9a2 --- /dev/null +++ b/schemas/test/en/test_new_calculated_summary_cross_section_dependencies_repeating.json @@ -0,0 +1,603 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Calculated Summary Cross Section Dependencies", + "theme": "default", + "description": "A questionnaire to demo resolution of calculated summary values across sections", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section", + "title": "Household", + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "primary-person-list-collector", + "type": "PrimaryPersonListCollector", + "for_list": "people", + "add_or_edit_block": { + "id": "add-or-edit-primary-person", + "type": "PrimaryPersonListAddOrEditQuestion", + "question": { + "id": "primary-person-add-or-edit-question", + "type": "General", + "title": "What is your name?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "question": { + "id": "primary-confirmation-question", + "type": "General", + "title": "Do you live here?", + "answers": [ + { + "id": "you-live-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "questions-section", + "title": "Questions", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "radio", + "title": "Questions", + "blocks": [ + { + "type": "Question", + "id": "skip-first-block", + "question": { + "type": "General", + "id": "skip-first-block-question", + "title": "Skip First Block so it doesn’t appear in Total?", + "answers": [ + { + "type": "Radio", + "id": "skip-first-block-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "skip-first-block-answer", + "source": "answers" + }, + "Yes" + ] + } + }, + "type": "Question", + "id": "first-number-block", + "question": { + "id": "first-number-question", + "title": "First Number Question Title", + "type": "General", + "answers": [ + { + "id": "first-number-answer", + "label": "First answer label (optional)", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "skip-first-block-answer", + "source": "answers" + }, + "Yes" + ] + } + }, + "type": "Question", + "id": "first-and-a-half-number-block", + "question": { + "id": "first-and-a-half-number-question-also-in-total", + "title": "First Number Additional Question Title", + "type": "General", + "answers": [ + { + "id": "first-and-a-half-number-answer-also-in-total", + "label": "First answer label also in total (optional)", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "second-number-block", + "question": { + "id": "second-number-question-also-in-total", + "title": "Second Number Additional Question Title", + "type": "General", + "answers": [ + { + "id": "second-number-answer-also-in-total", + "label": "Second answer label also in total (optional)", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "currency-total-playback-1", + "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "first-number-answer" + }, + { + "source": "answers", + "identifier": "first-and-a-half-number-answer-also-in-total" + }, + { + "source": "answers", + "identifier": "second-number-answer-also-in-total" + } + ] + }, + "title": "Grand total of previous values" + } + } + ] + } + ] + }, + { + "id": "calculated-summary-section", + "title": "Calculated Summary", + "summary": { "show_on_completion": true }, + "repeat": { + "for_list": "people", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "third-number-block", + "question": { + "id": "third-number-question", + "title": "Third Number Question Title", + "type": "General", + "answers": [ + { + "id": "third-number-answer", + "label": "Third answer in currency label", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "third-number-answer-also-in-total", + "label": "Third answer label also in currency total (optional)", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "currency-total-playback-2", + "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "third-number-answer" + }, + { + "source": "answers", + "identifier": "third-number-answer-also-in-total" + } + ] + }, + "title": "Grand total of previous values" + } + }, + { + "type": "Question", + "id": "mutually-exclusive-checkbox", + "question": { + "id": "mutually-exclusive-checkbox-question", + "type": "MutuallyExclusive", + "title": "Which answer did you give to question 4 and a half?", + "mandatory": false, + "answers": [ + { + "id": "checkbox-answer", + "instruction": "Select an answer", + "type": "Checkbox", + "mandatory": false, + "options": [ + { + "label": { + "placeholders": [ + { + "placeholder": "answer_value_1", + "value": { + "identifier": "first-and-a-half-number-answer-also-in-total", + "source": "answers" + } + } + ], + "text": "{answer_value_1} - first and a half answer" + }, + "value": "{answer_value_1}" + }, + { + "label": { + "placeholders": [ + { + "placeholder": "calc_value_1", + "value": { + "identifier": "currency-total-playback-1", + "source": "calculated_summary" + } + } + ], + "text": "{calc_value_1} - calculated summary answer (previous section)" + }, + "value": "{calc_value_1}" + }, + { + "label": { + "placeholders": [ + { + "placeholder": "calc_value_2", + "value": { + "identifier": "currency-total-playback-2", + "source": "calculated_summary" + } + } + ], + "text": "{calc_value_2} - calculated summary answer (current section)" + }, + "value": "{calc_value_2}" + }, + { + "label": { + "placeholders": [ + { + "placeholder": "third_answer_value", + "value": { + "identifier": "third-number-answer", + "source": "answers" + } + } + ], + "text": "{third_answer_value} - third answer" + }, + "value": "{third_answer_value}" + } + ] + }, + { + "id": "checkbox-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "description": "Some description", + "value": "I prefer not to say" + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "set-min-max-block", + "question": { + "answers": [ + { + "id": "set-minimum-answer", + "label": "Set a value greater than the total above", + "mandatory": true, + "description": "This is a description of the minimum value", + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "minimum": { + "value": { + "source": "calculated_summary", + "identifier": "currency-total-playback-1" + } + } + }, + { + "id": "set-maximum-answer", + "description": "This is a description of the maximum value", + "label": "Set a value less than the total above", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "maximum": { + "value": { + "source": "calculated_summary", + "identifier": "currency-total-playback-1" + } + } + } + ], + "id": "set-min-question", + "title": { + "placeholders": [ + { + "placeholder": "calculated_summary_answer", + "value": { + "identifier": "currency-total-playback-1", + "source": "calculated_summary" + } + } + ], + "text": "Set minimum and maximum values based on your calculated summary total of £{calculated_summary_answer}" + }, + "type": "General" + } + } + ], + "id": "calculated-summary" + } + ] + } + ] +} diff --git a/schemas/test/en/test_new_calculated_summary_dependent_questions.json b/schemas/test/en/test_new_calculated_summary_dependent_questions.json new file mode 100644 index 0000000000..ada5453af6 --- /dev/null +++ b/schemas/test/en/test_new_calculated_summary_dependent_questions.json @@ -0,0 +1,176 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "A test schema to demo Calculated Summary", + "description": "A schema to showcase Calculated Summary with dependent questions.", + "questionnaire_flow": { + "type": "Linear", + "options": {} + }, + "sections": [ + { + "id": "default-section", + "title": "Section 1", + "summary": { + "show_on_completion": false, + "collapsible": false + }, + "show_on_hub": true, + "groups": [ + { + "id": "group-1", + "blocks": [ + { + "id": "block-1", + "type": "Question", + "question": { + "id": "question-1", + "title": "How much did you spend on food?", + "type": "General", + "answers": [ + { + "id": "answer-1", + "mandatory": true, + "type": "Currency", + "label": "Money spent on food", + "description": "Enter the full value", + "minimum": { + "value": 0, + "exclusive": true + }, + "decimal_places": 2, + "currency": "GBP" + } + ] + } + }, + { + "id": "block-2", + "type": "Question", + "question": { + "id": "question-2", + "title": "Of the money spent on food, how much did you spend on vegetables?", + "type": "General", + "answers": [ + { + "id": "answer-2", + "mandatory": true, + "type": "Currency", + "label": "Money spent on vegetables", + "description": "Enter the full value", + "minimum": { + "value": 0, + "exclusive": true + }, + "maximum": { + "value": { + "identifier": "answer-1", + "source": "answers" + }, + "exclusive": false + }, + "decimal_places": 2, + "currency": "GBP" + } + ] + } + }, + { + "id": "block-3", + "type": "Question", + "question": { + "id": "question-3", + "title": "How much did you spend on clothes?", + "type": "General", + "answers": [ + { + "id": "answer-3", + "mandatory": true, + "type": "Currency", + "label": "Money spent on clothes", + "description": "Enter the full value", + "minimum": { + "value": 0, + "exclusive": true + }, + "decimal_places": 2, + "currency": "GBP" + } + ] + } + }, + { + "id": "block-4", + "type": "Question", + "question": { + "id": "question-4", + "title": "Of the money spent on clothes, how much did you spend on shoes?", + "type": "General", + "answers": [ + { + "id": "answer-4", + "mandatory": true, + "type": "Currency", + "label": "Money spent on shoes", + "description": "Enter the full value", + "minimum": { + "value": 0, + "exclusive": true + }, + "maximum": { + "value": { + "identifier": "answer-3", + "source": "answers" + }, + "exclusive": false + }, + "decimal_places": 2, + "currency": "GBP" + } + ] + } + }, + { + "id": "calculated-summary-block", + "type": "CalculatedSummary", + "title": "We have calculated your total spend to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "answer-1" + }, + { + "source": "answers", + "identifier": "answer-3" + } + ] + }, + "title": "Grand total of previous values" + } + } + ] + } + ] + } + ], + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ] +} diff --git a/schemas/test/en/test_new_calculated_summary_repeating_and_static_answers.json b/schemas/test/en/test_new_calculated_summary_repeating_and_static_answers.json new file mode 100644 index 0000000000..0a8a3ae325 --- /dev/null +++ b/schemas/test/en/test_new_calculated_summary_repeating_and_static_answers.json @@ -0,0 +1,727 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Calculated Summary with Dynamic Answers", + "theme": "default", + "description": "A questionnaire to demo calculated summaries which use a list of repeating answers.", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { "required_completed_sections": ["section-1"] } + }, + "sections": [ + { + "id": "section-1", + "title": "Weekly Shopping", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "supermarkets", + "title": "Supermarkets", + "add_link_text": "Add another supermarket", + "empty_list_text": "There are no supermarkets" + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "group", + "blocks": [ + { + "type": "ListCollectorDrivingQuestion", + "id": "any-supermarket", + "for_list": "supermarkets", + "question": { + "type": "General", + "id": "any-supermarket-question", + "title": "Do you visit any supermarkets for your weekly shopping?", + "answers": [ + { + "type": "Radio", + "id": "any-supermarket-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-supermarket", + "list_name": "supermarkets" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "section": "End", + "when": { + "==": [ + { + "source": "answers", + "identifier": "any-supermarket-answer" + }, + "No" + ] + } + }, + { + "block": "list-collector" + } + ] + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "supermarkets", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Do you need to add any more supermarkets?", + "answers": [ + { + "id": "list-collector-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-supermarket", + "type": "ListAddQuestion", + "cancel_text": "Don’t need to add any other supermarkets?", + "question": { + "id": "add-question", + "type": "General", + "title": "Which supermarkets do you use for your weekly shopping?", + "answers": [ + { + "id": "supermarket-name", + "label": "Supermarket", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-supermarket", + "type": "ListEditQuestion", + "cancel_text": "Don’t need to change anything?", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the supermarket?", + "answers": [ + { + "id": "supermarket-name", + "label": "Supermarket", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-supermarket", + "type": "ListRemoveQuestion", + "cancel_text": "Don’t need to remove this supermarket?", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this supermarket?", + "warning": "All of the information about this supermarket will be deleted", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Supermarkets", + "item_title": { + "text": "{supermarket_name}", + "placeholders": [ + { + "placeholder": "supermarket_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "supermarket-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "type": "Question", + "id": "dynamic-answer", + "skip_conditions": { + "when": { + "==": [ + { + "count": [ + { + "source": "list", + "identifier": "supermarkets" + } + ] + }, + 0 + ] + } + }, + "question": { + "dynamic_answers": { + "values": { + "source": "list", + "identifier": "supermarkets" + }, + "answers": [ + { + "label": { + "text": "How much do you spend on groceries at {transformed_value}?", + "placeholders": [ + { + "placeholder": "transformed_value", + "value": { + "source": "answers", + "identifier": "supermarket-name" + } + } + ] + }, + "id": "cost-of-shopping", + "type": "Currency", + "mandatory": true, + "currency": "GBP", + "decimal_places": 2 + }, + { + "label": { + "text": "How much do you spend on other items at {transformed_value}?", + "placeholders": [ + { + "placeholder": "transformed_value", + "value": { + "source": "answers", + "identifier": "supermarket-name" + } + } + ] + }, + "id": "cost-of-other", + "type": "Currency", + "mandatory": true, + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "days-a-week", + "label": { + "text": "How many days a week do you shop at {transformed_value}?", + "placeholders": [ + { + "placeholder": "transformed_value", + "value": { + "source": "answers", + "identifier": "supermarket-name" + } + } + ] + }, + "mandatory": false, + "type": "Number", + "decimal_places": 0, + "minimum": { + "value": 1 + }, + "maximum": { + "value": 7 + } + } + ] + }, + "answers": [ + { + "id": "based-checkbox-answer", + "label": "Are supermarkets UK or non UK based?", + "instruction": "Select any answers that apply", + "mandatory": false, + "options": [ + { + "label": "UK based supermarkets", + "value": "UK based supermarkets" + }, + { + "label": "Non UK based supermarkets", + "value": "Non UK based supermarkets" + } + ], + "type": "Checkbox" + }, + { + "id": "extra-static-answer", + "label": "How much do you spend on food at other types of shop?", + "type": "Currency", + "mandatory": false, + "currency": "GBP", + "decimal_places": 2 + } + ], + "id": "dynamic-answer-question", + "title": "How much do you spend each week at each of the following supermarket?", + "type": "General" + } + }, + { + "type": "Question", + "id": "extra-spending-block", + "question": { + "id": "extra-spending-question", + "title": "How much extra money do you spend each week on online food shopping?", + "type": "General", + "guidance": { + "contents": [ + { + "title": "How to test", + "list": [ + "If you enter a value other than £0 an additional question opens up.", + "Test that if you answer £0 to this question and then edit the answer from the calculated summary change link", + "First you are taken to the new question which opens up (provided it isn’t already complete), and only then back to the calculated summary" + ] + } + ] + }, + "answers": [ + { + "id": "extra-spending-answer", + "label": "Online food shopping expenditure", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "extra-spending-method-block", + "skip_conditions": { + "when": { + "==": [ + { + "source": "answers", + "identifier": "extra-spending-answer" + }, + 0 + ] + } + }, + "question": { + "id": "extra-spending-method-question", + "title": "Do you use a mobile phone to do online food shopping?", + "type": "General", + "answers": [ + { + "id": "extra-spending-method-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-spending", + "title": "We calculate the total cost of your weekly shopping to be %(total)s. Is this correct?", + "calculation": { + "title": "Weekly shopping cost", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "cost-of-shopping" + }, + { + "source": "answers", + "identifier": "cost-of-other" + }, + { + "source": "answers", + "identifier": "extra-spending-answer" + }, + { + "source": "answers", + "identifier": "extra-static-answer" + } + ] + } + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-visits", + "title": "We calculate the total visits to the shop to be %(total)s. Is this correct?", + "calculation": { + "title": "Weekly shopping trips", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "days-a-week" + } + ] + } + } + } + ] + } + ] + }, + { + "id": "section-2", + "title": "Shopping Details", + "enabled": { + "when": { + ">": [ + { + "source": "calculated_summary", + "identifier": "calculated-summary-spending" + }, + 0 + ] + } + }, + "groups": [ + { + "id": "group-2", + "blocks": [ + { + "type": "Question", + "id": "supermarket-transport", + "question": { + "id": "weekly-car-trips-question", + "title": { + "placeholders": [ + { + "placeholder": "total_visits", + "value": { + "identifier": "calculated-summary-visits", + "source": "calculated_summary" + } + } + ], + "text": "On how many of your {total_visits} weekly shopping trips do you travel by car?" + }, + "type": "General", + "answers": [ + { + "id": "weekly-car-trips-answer", + "label": "Number of visits by car", + "mandatory": true, + "description": "Cannot exceed the total weekly trips from section 1", + "type": "Number", + "decimal_places": 0, + "maximum": { + "value": { + "source": "calculated_summary", + "identifier": "calculated-summary-visits" + } + } + } + ] + } + }, + { + "type": "Question", + "id": "supermarket-transport-cost", + "skip_conditions": { + "when": { + "==": [ + { + "source": "answers", + "identifier": "weekly-car-trips-answer" + }, + 0 + ] + } + }, + "question": { + "id": "weekly-trips-cost", + "title": "How much do you spend on parking when travelling to the shop by car?", + "type": "General", + "answers": [ + { + "id": "weekly-trips-cost-answer", + "label": "Weekly spending on parking", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Interstitial", + "id": "calculated-summary-piping", + "content_variants": [ + { + "content": { + "title": "You have provided the following information about your weekly shop.", + "contents": [ + { + "list": [ + { + "text": "Total weekly supermarket spending: {currency_total}", + "placeholders": [ + { + "placeholder": "currency_total", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "source": "calculated_summary", + "identifier": "calculated-summary-spending" + } + } + } + ] + } + ] + }, + { + "text": "Total weekly supermarket visits: {number_total}", + "placeholders": [ + { + "placeholder": "number_total", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "calculated_summary", + "identifier": "calculated-summary-visits" + } + } + } + ] + } + ] + }, + { + "text": "Total of supermarket visits by car: {number_total}", + "placeholders": [ + { + "placeholder": "number_total", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "answers", + "identifier": "weekly-car-trips-answer" + } + } + } + ] + } + ] + } + ] + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "weekly-car-trips-answer" + }, + 0 + ] + } + }, + { + "content": { + "title": "You have provided the following information about your weekly shop.", + "contents": [ + { + "list": [ + { + "text": "Total weekly supermarket spending: {currency_total}", + "placeholders": [ + { + "placeholder": "currency_total", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "source": "calculated_summary", + "identifier": "calculated-summary-spending" + } + } + } + ] + } + ] + }, + { + "text": "Total weekly supermarket visits: {number_total}", + "placeholders": [ + { + "placeholder": "number_total", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "calculated_summary", + "identifier": "calculated-summary-visits" + } + } + } + ] + } + ] + }, + { + "text": "Total of supermarket visits by car: {number_total}", + "placeholders": [ + { + "placeholder": "number_total", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "answers", + "identifier": "weekly-car-trips-answer" + } + } + } + ] + } + ] + }, + { + "text": "Total spending on parking: {currency_total}", + "placeholders": [ + { + "placeholder": "currency_total", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "source": "answers", + "identifier": "weekly-trips-cost-answer" + } + } + } + ] + } + ] + } + ] + } + ] + }, + "when": { + ">": [ + { + "source": "answers", + "identifier": "weekly-car-trips-answer" + }, + 0 + ] + } + } + ] + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_new_calculated_summary_repeating_answers_only.json b/schemas/test/en/test_new_calculated_summary_repeating_answers_only.json new file mode 100644 index 0000000000..40a6de8f9f --- /dev/null +++ b/schemas/test/en/test_new_calculated_summary_repeating_answers_only.json @@ -0,0 +1,322 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Calculated Summary with Dynamic Answers", + "theme": "default", + "description": "A simple demo of a calculated summary which uses a list of repeating answers.", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": {} + }, + "sections": [ + { + "id": "section", + "title": "List Collector Section", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "transport", + "title": "Transport", + "add_link_text": "Add another method of transport", + "empty_list_text": "There are no uses of public transport" + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "group", + "blocks": [ + { + "type": "ListCollectorDrivingQuestion", + "id": "any-transport", + "for_list": "transport", + "question": { + "type": "General", + "id": "any-transport-question", + "title": "Do you use public transport?", + "answers": [ + { + "type": "Radio", + "id": "any-transport-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-transport", + "list_name": "transport" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "section": "End", + "when": { + "==": [ + { + "source": "answers", + "identifier": "any-transport-answer" + }, + "No" + ] + } + }, + { + "block": "list-collector" + } + ] + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "transport", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Do you need to add any more types of transport?", + "answers": [ + { + "id": "list-collector-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-transport", + "type": "ListAddQuestion", + "cancel_text": "Don’t need to add any other type of transport?", + "question": { + "id": "add-question", + "type": "General", + "title": "Which types of public transport do you use?", + "answers": [ + { + "id": "transport-name", + "label": "Transport type", + "mandatory": true, + "type": "Dropdown", + "options": [ + { + "label": "Train", + "value": "Train" + }, + { + "label": "Bus", + "value": "Bus" + }, + { + "label": "Tube", + "value": "Tube" + } + ] + } + ] + } + }, + "edit_block": { + "id": "edit-transport", + "type": "ListEditQuestion", + "cancel_text": "Don’t need to change anything?", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the type of public transport?", + "answers": [ + { + "id": "transport-name", + "label": "Transport type", + "mandatory": true, + "type": "Dropdown", + "options": [ + { + "label": "Train", + "value": "Train" + }, + { + "label": "Bus", + "value": "Bus" + }, + { + "label": "Tube", + "value": "Tube" + } + ] + } + ] + } + }, + "remove_block": { + "id": "remove-transport", + "type": "ListRemoveQuestion", + "cancel_text": "Don’t need to remove this method of transport?", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this method of transport?", + "warning": "All of the information about this method of transport will be deleted", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "transport", + "item_title": { + "text": "{transport_name}", + "placeholders": [ + { + "placeholder": "transport_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "transport-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "type": "Question", + "id": "dynamic-answer", + "skip_conditions": { + "when": { + "==": [ + { + "count": [ + { + "source": "list", + "identifier": "transport" + } + ] + }, + 0 + ] + } + }, + "question": { + "dynamic_answers": { + "values": { + "source": "list", + "identifier": "transport" + }, + "answers": [ + { + "label": { + "text": "How much do you spend per month travelling by {transformed_value}?", + "placeholders": [ + { + "placeholder": "transformed_value", + "value": { + "source": "answers", + "identifier": "transport-name" + } + } + ] + }, + "id": "cost-of-transport", + "type": "Currency", + "mandatory": true, + "currency": "GBP", + "decimal_places": 2 + } + ] + }, + "id": "dynamic-answer-question", + "title": "How much do you spend per month on the following modes of public transport?", + "type": "General" + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-spending", + "title": "We calculate the total monthly spending on public transport to be %(total)s. Is this correct?", + "calculation": { + "title": "Monthly public transport spending", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "cost-of-transport" + } + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_new_calculated_summary_repeating_blocks.json b/schemas/test/en/test_new_calculated_summary_repeating_blocks.json new file mode 100644 index 0000000000..249413b174 --- /dev/null +++ b/schemas/test/en/test_new_calculated_summary_repeating_blocks.json @@ -0,0 +1,521 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Calculated Summary of answers from Repeating blocks", + "theme": "default", + "description": "A demo of a calculated summary which uses a answers from the repeating blocks in a list collector.", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { + "required_completed_sections": ["section-1"] + } + }, + "sections": [ + { + "id": "section-1", + "title": "Transport", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "transport", + "title": "transport", + "item_anchor_answer_id": "transport-name", + "item_label": "Name of transport", + "add_link_text": "Add another method of transport", + "empty_list_text": "No method of transport added" + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "group-1", + "blocks": [ + { + "id": "block-car", + "type": "Question", + "question": { + "id": "question-car", + "type": "General", + "title": "How much do you spend per month travelling by Car?", + "answers": [ + { + "id": "answer-car", + "label": "Monthly expenditure travelling by car", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "id": "block-skip", + "type": "Question", + "question": { + "id": "question-skip", + "type": "General", + "title": "Would you like to skip the list collector that asks about other methods of transport?", + "guidance": { + "contents": [ + { + "description": "Use this to check the calculated summary shows the correct values when the list collector is not on the path." + } + ] + }, + "answers": [ + { + "id": "answer-skip", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "list-collector", + "when": { + "==": [ + { + "identifier": "answer-skip", + "source": "answers" + }, + "No" + ] + } + }, + { + "block": "calculated-summary-spending" + } + ] + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "transport", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Do you use any other methods of transport?", + "answers": [ + { + "id": "list-collector-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-transport", + "type": "ListAddQuestion", + "cancel_text": "Don’t need to add any other method of transport?", + "question": { + "id": "add-question", + "type": "General", + "title": "What other method of transport do you use?", + "answers": [ + { + "id": "transport-name", + "label": "Transport", + "mandatory": true, + "type": "Dropdown", + "options": [ + { + "label": "Tube", + "value": "Tube" + }, + { + "label": "Bus", + "value": "Bus" + }, + { + "label": "Train", + "value": "Train" + }, + { + "label": "Plane", + "value": "Plane" + } + ] + } + ] + } + }, + "edit_block": { + "id": "edit-transport", + "type": "ListEditQuestion", + "cancel_text": "Don’t need to add any other method of transport?", + "question": { + "id": "add-question", + "type": "General", + "title": "What other method of transport do you use?", + "answers": [ + { + "id": "transport-name", + "label": "Transport", + "mandatory": true, + "type": "Dropdown", + "options": [ + { + "label": "Tube", + "value": "Tube" + }, + { + "label": "Bus", + "value": "Bus" + }, + { + "label": "Train", + "value": "Train" + }, + { + "label": "Plane", + "value": "Plane" + } + ] + } + ] + } + }, + "remove_block": { + "id": "remove-transport", + "type": "ListRemoveQuestion", + "cancel_text": "Don’t need to remove this method of transport?", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this method of transport?", + "warning": "All of the information about this method of transport will be deleted", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "repeating_blocks": [ + { + "id": "transport-repeating-block-1", + "type": "ListRepeatingQuestion", + "question": { + "id": "transport-repeating-block-1-question", + "type": "General", + "title": { + "text": "Give details of your expenditure travelling by {transport_name}", + "placeholders": [ + { + "placeholder": "transport_name", + "value": { + "source": "answers", + "identifier": "transport-name" + } + } + ] + }, + "answers": [ + { + "id": "transport-company", + "label": { + "placeholders": [ + { + "placeholder": "transport_name", + "value": { + "source": "answers", + "identifier": "transport-name" + } + } + ], + "text": "Which company do primarily use for travelling by {transport_name}?" + }, + "mandatory": false, + "type": "TextField" + }, + { + "id": "transport-cost", + "label": { + "placeholders": [ + { + "placeholder": "transport_name", + "value": { + "source": "answers", + "identifier": "transport-name" + } + } + ], + "text": "Monthly season ticket expenditure for travel by {transport_name}" + }, + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "transport-additional-cost", + "label": { + "placeholders": [ + { + "placeholder": "transport_name", + "value": { + "source": "answers", + "identifier": "transport-name" + } + } + ], + "text": "Additional monthly expenditure for travel by {transport_name}" + }, + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "id": "transport-repeating-block-2", + "type": "ListRepeatingQuestion", + "question": { + "id": "transport-repeating-block-2-question-1", + "type": "General", + "title": { + "text": "How often do you travel by {transport_name}?", + "placeholders": [ + { + "placeholder": "transport_name", + "value": { + "source": "answers", + "identifier": "transport-name" + } + } + ] + }, + "answers": [ + { + "id": "transport-count", + "label": { + "placeholders": [ + { + "placeholder": "transport_name", + "value": { + "source": "answers", + "identifier": "transport-name" + } + } + ], + "text": "Monthly journeys by {transport_name}" + }, + "mandatory": false, + "type": "Number" + } + ] + } + } + ], + "summary": { + "title": "transport", + "item_title": { + "text": "{transport_name}", + "placeholders": [ + { + "placeholder": "transport_name", + "value": { + "source": "answers", + "identifier": "transport-name" + } + } + ] + } + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-spending", + "title": "We calculate the total monthly expenditure on transport to be %(total)s. Is this correct?", + "calculation": { + "title": "Monthly transport expenditure", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "answer-car" + }, + { + "source": "answers", + "identifier": "transport-cost" + }, + { + "source": "answers", + "identifier": "transport-additional-cost" + } + ] + } + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-count", + "title": "We calculate the total journeys made per month to be %(total)s. Is this correct?", + "calculation": { + "title": "Monthly journeys", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "transport-count" + } + ] + } + }, + "skip_conditions": { + "when": { + "or": [ + { + "==": [ + { + "count": [ + { + "source": "list", + "identifier": "transport" + } + ] + }, + 0 + ] + }, + { + "==": [ + { + "source": "answers", + "identifier": "answer-skip" + }, + "Yes" + ] + } + ] + } + } + } + ] + } + ] + }, + { + "enabled": { + "when": { + ">": [ + { + "source": "calculated_summary", + "identifier": "calculated-summary-count" + }, + 0 + ] + } + }, + "id": "section-2", + "summary": { + "show_on_completion": true + }, + "title": "Travel Details", + "groups": [ + { + "id": "group-2", + "blocks": [ + { + "type": "Question", + "id": "family-journeys", + "question": { + "id": "family-journeys-question", + "title": { + "placeholders": [ + { + "placeholder": "total_journeys", + "value": { + "identifier": "calculated-summary-count", + "source": "calculated_summary" + } + } + ], + "text": "How many of your {total_journeys} journeys are to visit family?" + }, + "type": "General", + "answers": [ + { + "id": "family-journeys-answer", + "label": "Number of trips to visit family", + "mandatory": true, + "description": "Cannot exceed the total journeys from section 1", + "type": "Number", + "maximum": { + "value": { + "source": "calculated_summary", + "identifier": "calculated-summary-count" + } + } + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_new_calculated_summary_repeating_section.json b/schemas/test/en/test_new_calculated_summary_repeating_section.json new file mode 100644 index 0000000000..a01eeb68cf --- /dev/null +++ b/schemas/test/en/test_new_calculated_summary_repeating_section.json @@ -0,0 +1,820 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "A test schema to demo Calculated Summary", + "theme": "default", + "description": "A schema to showcase Calculated Summary pages and usage in value source in repeating sections", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section", + "title": "Household", + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "primary-person-list-collector", + "type": "PrimaryPersonListCollector", + "for_list": "people", + "add_or_edit_block": { + "id": "add-or-edit-primary-person", + "type": "PrimaryPersonListAddOrEditQuestion", + "question": { + "id": "primary-person-add-or-edit-question", + "type": "General", + "title": "What is your name?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "question": { + "id": "primary-confirmation-question", + "type": "General", + "title": "Do you live here?", + "answers": [ + { + "id": "you-live-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "personal-details-section", + "title": "Personal Details", + "summary": { + "show_on_completion": true + }, + "repeat": { + "for_list": "people", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "groups": [ + { + "id": "personal-details-group", + "title": "Personal Details", + "blocks": [ + { + "type": "Question", + "id": "first-number-block", + "question": { + "id": "first-number-question", + "title": "First Number Question Title", + "type": "General", + "answers": [ + { + "id": "first-number-answer", + "label": "First answer label", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "second-number-block", + "question": { + "id": "second-number-question", + "title": "Second Number Question Title", + "type": "General", + "answers": [ + { + "id": "second-number-answer", + "label": "Second answer in currency label", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "second-number-answer-unit-total", + "label": "Second answer label in unit total", + "mandatory": true, + "type": "Unit", + "unit_length": "short", + "unit": "length-centimeter" + }, + { + "id": "second-number-answer-also-in-total", + "label": "Second answer label also in currency total (optional)", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "third-number-block", + "question": { + "id": "third-number-question", + "title": "Third Number Question Title", + "type": "General", + "answers": [ + { + "id": "third-number-answer", + "label": "Third answer label", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "third-and-a-half-number-block", + "question": { + "id": "third-and-a-half-number-question-unit-total", + "title": "Third Number Question Title Unit Total", + "type": "General", + "answers": [ + { + "id": "third-and-a-half-number-answer-unit-total", + "label": "Third answer label in unit total", + "mandatory": true, + "type": "Unit", + "unit_length": "short", + "unit": "length-centimeter" + } + ] + } + }, + { + "type": "Question", + "id": "skip-fourth-block", + "question": { + "type": "General", + "id": "skip-fourth-block-question", + "title": "Skip Fourth Block so it doesn’t appear in Total?", + "answers": [ + { + "type": "Radio", + "id": "skip-fourth-block-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "skip-fourth-block-answer", + "source": "answers" + }, + "Yes" + ] + } + }, + "type": "Question", + "id": "fourth-number-block", + "question": { + "id": "fourth-number-question", + "title": "Fourth Number Question Title", + "type": "General", + "answers": [ + { + "id": "fourth-number-answer", + "label": "Fourth answer label (optional)", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "skip-fourth-block-answer", + "source": "answers" + }, + "Yes" + ] + } + }, + "type": "Question", + "id": "fourth-and-a-half-number-block", + "question": { + "id": "fourth-and-a-half-number-question-also-in-total", + "title": "Fourth Number Additional Question Title", + "type": "General", + "answers": [ + { + "id": "fourth-and-a-half-number-answer-also-in-total", + "label": "Fourth answer label also in total (optional)", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "fifth-number-block", + "question": { + "id": "fifth-number-question", + "title": "Fifth Number Question Title Percentage", + "type": "General", + "answers": [ + { + "id": "fifth-percent-answer", + "label": "Fifth answer label percentage total", + "mandatory": true, + "type": "Percentage", + "maximum": { + "value": 100 + } + }, + { + "id": "fifth-number-answer", + "label": "Fifth answer label number total", + "mandatory": false, + "type": "Number", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "sixth-number-block", + "question": { + "id": "sixth-number-question", + "title": "Sixth Number Question Title Percentage", + "type": "General", + "answers": [ + { + "id": "sixth-percent-answer", + "label": "Sixth answer label percentage total", + "mandatory": true, + "type": "Percentage", + "maximum": { + "value": 100 + } + }, + { + "id": "sixth-number-answer", + "label": "Sixth answer label number total", + "mandatory": false, + "type": "Number", + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "currency-total-playback", + "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "first-number-answer" + }, + { + "source": "answers", + "identifier": "second-number-answer" + }, + { + "source": "answers", + "identifier": "second-number-answer-also-in-total" + }, + { + "source": "answers", + "identifier": "third-number-answer" + }, + { + "source": "answers", + "identifier": "fourth-number-answer" + }, + { + "source": "answers", + "identifier": "fourth-and-a-half-number-answer-also-in-total" + } + ] + }, + "title": "Grand total of previous values" + } + }, + { + "type": "CalculatedSummary", + "id": "unit-total-playback", + "title": "We calculate the total of unit values entered to be %(total)s. Is this correct?", + "page_title": "Total Unit Values", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "second-number-answer-unit-total" + }, + { + "source": "answers", + "identifier": "third-and-a-half-number-answer-unit-total" + } + ] + }, + "title": "Grand total of previous values" + } + }, + { + "type": "CalculatedSummary", + "id": "percentage-total-playback", + "title": "We calculate the total of percentage values entered to be %(total)s. Is this correct?", + "page_title": "Percentage Calculated Summary: Person {list_item_position}", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "fifth-percent-answer" + }, + { + "source": "answers", + "identifier": "sixth-percent-answer" + } + ] + }, + "title": "Grand total of previous values" + } + }, + { + "type": "CalculatedSummary", + "id": "number-total-playback", + "title": "We calculate the total of number values entered to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "fifth-number-answer" + }, + { + "source": "answers", + "identifier": "sixth-number-answer" + } + ] + }, + "title": "Grand total of previous values" + } + }, + { + "id": "breakdown", + "type": "Question", + "question": { + "id": "breakdown-question", + "title": { + "text": "Enter two values that add up to the previous calculated summary total of {total_first}", + "placeholders": [ + { + "placeholder": "total_first", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "identifier": "number-total-playback", + "source": "calculated_summary" + } + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "breakdown-answer-1", + "mandatory": false, + "type": "Currency", + "label": "First Value", + "decimal_places": 2, + "currency": "GBP" + }, + { + "id": "breakdown-answer-2", + "mandatory": false, + "type": "Currency", + "label": "Second Value", + "decimal_places": 2, + "currency": "GBP" + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "second-currency-total-playback", + "title": "We calculate the total of number values entered to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "breakdown-answer-1" + }, + { + "source": "answers", + "identifier": "breakdown-answer-2" + } + ] + }, + "title": "Grand total of previous values" + } + }, + { + "type": "Interstitial", + "id": "calculated-summary-total-confirmation", + "content": { + "title": "You have provided the following grand totals.", + "contents": [ + { + "list": [ + { + "text": "Total currency values: {currency_total}", + "placeholders": [ + { + "placeholder": "currency_total", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "source": "calculated_summary", + "identifier": "currency-total-playback" + } + } + } + ] + } + ] + }, + { + "text": "Total unit values: {unit_total}", + "placeholders": [ + { + "placeholder": "unit_total", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "calculated_summary", + "identifier": "unit-total-playback" + } + } + } + ] + } + ] + }, + { + "text": "Total percentage values: {percentage_total}", + "placeholders": [ + { + "placeholder": "percentage_total", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "calculated_summary", + "identifier": "percentage-total-playback" + } + } + } + ] + } + ] + }, + { + "text": "Total number values: {number_total}", + "placeholders": [ + { + "placeholder": "number_total", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "calculated_summary", + "identifier": "number-total-playback" + } + } + } + ] + } + ] + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "set-min-max-block", + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "skip-fourth-block-answer", + "source": "answers" + }, + "No" + ] + } + }, + "question": { + "answers": [ + { + "id": "set-minimum-answer", + "label": "Set a value greater than the total above", + "mandatory": true, + "description": "This is a description of the minimum value", + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "minimum": { + "value": { + "source": "calculated_summary", + "identifier": "currency-total-playback" + } + } + }, + { + "id": "set-maximum-answer", + "description": "This is a description of the maximum value", + "label": "Set a value less than the total above", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "maximum": { + "value": { + "source": "calculated_summary", + "identifier": "currency-total-playback" + } + } + } + ], + "id": "set-min-question", + "title": { + "placeholders": [ + { + "placeholder": "calculated_summary_answer", + "value": { + "identifier": "currency-total-playback", + "source": "calculated_summary" + } + } + ], + "text": "Set minimum and maximum values based on your calculated summary total of £{calculated_summary_answer}" + }, + "type": "General" + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_numbers.json b/schemas/test/en/test_numbers.json new file mode 100644 index 0000000000..195f2ea576 --- /dev/null +++ b/schemas/test/en/test_numbers.json @@ -0,0 +1,547 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "023", + "title": "Test Numeric Range", + "description": "Test Description", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "set-min-max-block", + "question": { + "answers": [ + { + "id": "set-minimum", + "label": "Minimum Value", + "description": "This is a description of the minimum value", + "mandatory": true, + "type": "Number", + "decimal_places": 2, + "minimum": { + "value": -1000.98 + }, + "maximum": { + "value": 1000 + } + }, + { + "id": "set-maximum", + "description": "This is a description of the maximum value", + "label": "Maximum Value", + "mandatory": true, + "type": "Number", + "decimal_places": 2, + "minimum": { + "value": 1001 + }, + "maximum": { + "value": 10000.98 + } + } + ], + "id": "set-min-question", + "title": "Please set the minimum and maximum used for future questions", + "type": "General" + } + }, + { + "type": "Question", + "id": "test-min-max-block", + "question": { + "answers": [ + { + "id": "test-range", + "label": "Range Test", + "description": { + "text": "Range Test ({minimum} to {maximum})", + "placeholders": [ + { + "placeholder": "minimum", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "answers", + "identifier": "set-minimum" + } + } + } + ] + }, + { + "placeholder": "maximum", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "answers", + "identifier": "set-maximum" + } + } + } + ] + } + ] + }, + "mandatory": true, + "type": "Number", + "decimal_places": 2, + "maximum": { + "value": { + "source": "answers", + "identifier": "set-maximum" + } + }, + "minimum": { + "value": { + "source": "answers", + "identifier": "set-minimum" + } + } + }, + { + "id": "test-range-exclusive", + "label": "Range Exclusive Test", + "description": { + "text": "Range Exclusive Test ({minimum} to {maximum} Exclusive)", + "placeholders": [ + { + "placeholder": "minimum", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "answers", + "identifier": "set-minimum" + } + } + } + ] + }, + { + "placeholder": "maximum", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "answers", + "identifier": "set-maximum" + } + } + } + ] + } + ] + }, + "mandatory": false, + "type": "Number", + "decimal_places": 2, + "maximum": { + "value": { + "source": "answers", + "identifier": "set-maximum" + }, + "exclusive": true + }, + "minimum": { + "value": { + "source": "answers", + "identifier": "set-minimum" + }, + "exclusive": true + } + }, + { + "id": "test-min", + "label": "Min Test (-123 to 999,999,999,999,999)", + "mandatory": false, + "type": "Number", + "minimum": { + "value": -123 + } + }, + { + "id": "test-max", + "label": "Max Test (0 to 1,234)", + "mandatory": false, + "type": "Number", + "maximum": { + "value": 1234 + } + }, + { + "id": "test-min-exclusive", + "label": "Min Exclusive Test (124 to 999,999,999,999,999 - 123 Exclusive)", + "mandatory": false, + "type": "Number", + "minimum": { + "value": 123, + "exclusive": true + } + }, + { + "id": "test-max-exclusive", + "label": "Max Exclusive Test (0 to 1,233 - 1,234 Exclusive)", + "mandatory": false, + "type": "Number", + "maximum": { + "value": 1234, + "exclusive": true + } + }, + { + "id": "test-percent", + "label": "Percent Test (0 to 100)", + "mandatory": false, + "type": "Percentage", + "maximum": { + "value": 100 + } + }, + { + "id": "test-decimal", + "label": "Decimal Test", + "description": { + "text": "Range Exclusive Test ({minimum} to {maximum} Exclusive)", + "placeholders": [ + { + "placeholder": "minimum", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "answers", + "identifier": "set-minimum" + } + } + } + ] + }, + { + "placeholder": "maximum", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "answers", + "identifier": "set-maximum" + } + } + } + ] + } + ] + }, + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 5, + "maximum": { + "value": { + "source": "answers", + "identifier": "set-maximum" + } + }, + "minimum": { + "value": { + "source": "answers", + "identifier": "set-minimum" + } + } + } + ], + "id": "test-min-max-range-question", + "title": "Please enter test values (none mandatory)", + "type": "General" + } + }, + { + "type": "Question", + "id": "detail-answer-block", + "question": { + "answers": [ + { + "id": "detail-answer", + "mandatory": true, + "options": [ + { + "label": "1", + "value": "1" + }, + { + "label": "2", + "value": "2" + }, + { + "label": "Other", + "value": "Other", + "detail_answer": { + "mandatory": false, + "id": "other-answer", + "label": "Please specify other", + "type": "Number", + "maximum": { + "value": { + "source": "answers", + "identifier": "test-range" + } + } + } + } + ], + "type": "Checkbox" + } + ], + "id": "detail-answer-question", + "title": { + "text": "Please enter test values for detail answer Less or equal than {maximum}", + "placeholders": [ + { + "placeholder": "maximum", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "answers", + "identifier": "test-range" + } + } + } + ] + } + ] + }, + "type": "General" + } + } + ], + "id": "test" + } + ] + }, + { + "id": "currency-section", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "currency-group", + "title": "Section Summary With Variants", + "blocks": [ + { + "type": "Question", + "id": "currency-block", + "question": { + "id": "currency-question", + "type": "General", + "title": "What currency would you like", + "answers": [ + { + "id": "currency-answer", + "type": "Radio", + "mandatory": true, + "options": [ + { + "label": "US Dollars", + "value": "US Dollars" + }, + { + "label": "Sterling", + "value": "Sterling" + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "first-number-block", + "question_variants": [ + { + "question": { + "id": "first-number-question", + "title": "First Number Question Title", + "type": "General", + "answers": [ + { + "id": "first-number-answer", + "label": "First answer in GBP", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "maximum": { + "value": 1000 + }, + "minimum": { + "value": 1 + } + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "currency-answer" + }, + "Sterling" + ] + } + }, + { + "question": { + "id": "first-number-question", + "title": "First Number Question Title", + "type": "General", + "answers": [ + { + "id": "first-number-answer", + "label": "First answer in USD", + "mandatory": true, + "type": "Currency", + "currency": "USD", + "decimal_places": 2, + "maximum": { + "value": 100 + }, + "minimum": { + "value": 10 + } + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "currency-answer" + }, + "US Dollars" + ] + } + } + ] + }, + { + "type": "Question", + "id": "second-number-block", + "question_variants": [ + { + "question": { + "id": "second-number-question", + "title": "Second Number Question Title", + "type": "General", + "answers": [ + { + "id": "second-number-answer", + "label": "Second answer in GBP", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "maximum": { + "value": { + "source": "answers", + "identifier": "first-number-answer" + } + }, + "minimum": { + "value": { + "source": "answers", + "identifier": "first-number-answer" + } + } + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "currency-answer" + }, + "Sterling" + ] + } + }, + { + "question": { + "id": "second-number-question", + "title": "Second Number Question Title", + "type": "General", + "answers": [ + { + "id": "second-number-answer", + "label": "Second answer in USD", + "mandatory": true, + "type": "Currency", + "currency": "USD", + "decimal_places": 2, + "maximum": { + "value": { + "source": "answers", + "identifier": "set-maximum" + } + }, + "minimum": { + "value": 100 + } + } + ] + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "currency-answer" + }, + "US Dollars" + ] + } + } + ] + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_optional_guidance_and_description.json b/schemas/test/en/test_optional_guidance_and_description.json new file mode 100644 index 0000000000..38cdb32f44 --- /dev/null +++ b/schemas/test/en/test_optional_guidance_and_description.json @@ -0,0 +1,219 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Other input fields", + "theme": "default", + "description": "A questionnaire to demo optional question guidance and descriptions", + "metadata": [ + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "user_id", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "description-block", + "question": { + "answers": [ + { + "id": "answer-1", + "label": "Enter any description text that you want to be displayed", + "max_length": 20, + "mandatory": false, + "type": "TextField" + }, + { + "id": "answer-2", + "label": "Enter any alternative text that you want to be displayed", + "max_length": 20, + "mandatory": false, + "type": "TextField" + } + ], + "description": [ + "If entered, only one of the text fields will be used for the description as the next question uses the first_non_empty_item placeholder" + ], + "id": "description-question", + "title": "Do not enter anything here so you get an empty question description and question guidance on the following pages!", + "type": "General" + } + }, + { + "type": "Question", + "id": "mandatory-radio", + "question": { + "guidance": { + "contents": [ + { + "description": { + "text": "{description_text}", + "placeholders": [ + { + "placeholder": "description_text", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "answers", + "identifier": "answer-1" + }, + { + "source": "answers", + "identifier": "answer-2" + } + ] + } + } + ] + } + ] + } + } + ] + }, + "description": [ + { + "text": "{description_text}", + "placeholders": [ + { + "placeholder": "description_text", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "answers", + "identifier": "answer-1" + }, + { + "source": "answers", + "identifier": "answer-2" + } + ] + } + } + ] + } + ] + } + ], + "answers": [ + { + "id": "mandatory-radio-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "mandatory-radio-question", + "title": "Were the question description and guidance displayed?", + "type": "General" + } + }, + { + "type": "Question", + "id": "mandatory-radio-two", + "question": { + "guidance": { + "contents": [ + { + "description": "Description with an empty content list" + }, + { + "list": [ + "List item one", + { + "text": "{description_text}", + "placeholders": [ + { + "placeholder": "description_text", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "answers", + "identifier": "answer-1" + }, + { + "source": "answers", + "identifier": "answer-2" + } + ] + } + } + ] + } + ] + } + ] + } + ] + }, + "answers": [ + { + "id": "mandatory-radio-answer-two", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "mandatory-radio-question-two", + "title": "Was the contents list in the question guidance displayed?", + "type": "General" + } + } + ], + "id": "radios" + } + ] + } + ] +} diff --git a/schemas/test/en/test_percentage.json b/schemas/test/en/test_percentage.json new file mode 100644 index 0000000000..29d9c586d4 --- /dev/null +++ b/schemas/test/en/test_percentage.json @@ -0,0 +1,91 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Percentage Field Demo", + "theme": "default", + "description": "A questionnaire to test percentage input type", + "navigation": { + "visible": true + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "percent-input-section", + "title": "Percent Input", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "block", + "question": { + "answers": [ + { + "description": "Enter percentage of growth", + "id": "answer", + "label": "New to the market 2012-2014", + "mandatory": false, + "type": "Percentage", + "maximum": { + "value": 100 + } + } + ], + "id": "question", + "title": "Enter a percentage", + "type": "General" + } + }, + { + "type": "Question", + "id": "block-decimal", + "question": { + "answers": [ + { + "description": "Enter percentage of growth", + "id": "answer-decimal", + "label": "New to the market 2012-2014", + "mandatory": false, + "type": "Percentage", + "maximum": { + "value": 100 + }, + "decimal_places": 3 + } + ], + "id": "question-decimal", + "title": "Enter a percentage with up to 3 decimal places", + "type": "General" + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_placeholder_based_on_first_item_in_list.json b/schemas/test/en/test_placeholder_based_on_first_item_in_list.json new file mode 100644 index 0000000000..5b6a1543b0 --- /dev/null +++ b/schemas/test/en/test_placeholder_based_on_first_item_in_list.json @@ -0,0 +1,386 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Repeating Section Summaries", + "theme": "default", + "description": "A questionnaire to repeating section summary functionality", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section", + "title": "Household", + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "personal-details-section", + "title": "Personal Details", + "summary": { + "show_on_completion": true + }, + "repeat": { + "for_list": "people", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "groups": [ + { + "id": "personal-details-group", + "title": "Personal Details", + "blocks": [ + { + "content_variants": [ + { + "content": { + "contents": [ + { + "description": "You are the first person in the list" + } + ], + "title": "List Status" + }, + "when": { + "==": [ + { + "identifier": "people", + "source": "list", + "selector": "first" + }, + { + "source": "location", + "identifier": "list_item_id" + } + ] + } + }, + { + "content": { + "contents": [ + { + "description": "You are not the first person in the list" + } + ], + "title": "List Status" + }, + "when": { + "!=": [ + { + "identifier": "people", + "source": "list", + "selector": "first" + }, + { + "source": "location", + "identifier": "list_item_id" + } + ] + } + } + ], + "id": "list-status", + "type": "Interstitial" + }, + { + "type": "Question", + "id": "favourite-drink", + "question": { + "answers": [ + { + "id": "favourite-drink-answer", + "label": "What is your favourite drink", + "max_length": 20, + "mandatory": false, + "type": "TextField" + } + ], + "id": "favourite-drink-question", + "title": "Title", + "type": "General" + } + }, + { + "id": "list-status-2", + "question_variants": [ + { + "question": { + "answers": [ + { + "id": "list-status-answer-2", + "mandatory": false, + "options": [ + { + "label": "Tea", + "value": "Tea" + }, + { + "label": "Coffee", + "value": "Coffee" + } + ], + "type": "Radio" + } + ], + "id": "list-status-question-2", + "title": "What is your second favourite drink?", + "type": "General" + }, + "when": { + "==": [ + { + "identifier": "people", + "source": "list", + "selector": "first" + }, + { + "source": "location", + "identifier": "list_item_id" + } + ] + } + }, + { + "question": { + "answers": [ + { + "id": "list-status-answer-2", + "mandatory": false, + "options": [ + { + "label": { + "text": "{answer}", + "placeholders": [ + { + "placeholder": "answer", + "value": { + "source": "answers", + "identifier": "favourite-drink-answer", + "list_item_selector": { + "source": "list", + "identifier": "people", + "selector": "first" + } + } + } + ] + }, + "value": "{answer}" + }, + { + "label": "Other", + "value": "Other" + } + ], + "type": "Radio" + } + ], + "id": "list-status-question-2", + "title": "What is your second favourite drink?", + "type": "General" + }, + "when": { + "!=": [ + { + "identifier": "people", + "source": "list", + "selector": "first" + }, + { + "source": "location", + "identifier": "list_item_id" + } + ] + } + } + ], + "type": "Question" + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_placeholder_default_value.json b/schemas/test/en/test_placeholder_default_value.json new file mode 100644 index 0000000000..227ab461bd --- /dev/null +++ b/schemas/test/en/test_placeholder_default_value.json @@ -0,0 +1,169 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Placeholder default value", + "theme": "default", + "description": "A questionnaire to demo Placeholder default value.", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "employees-number-block", + "question": { + "answers": [ + { + "id": "employees-no", + "mandatory": false, + "decimal_places": 0, + "type": "Number", + "label": "Total number of employees", + "default": 0 + } + ], + "id": "employees-no-question", + "title": { + "text": "What is the number of employees for the {ru_name} ?", + "placeholders": [ + { + "placeholder": "ru_name", + "value": { + "source": "metadata", + "identifier": "ru_name" + } + } + ] + }, + "guidance": { + "contents": [ + { + "description": "Leave the text box blank to see the default value on the next page" + } + ] + }, + "type": "General" + } + }, + { + "id": "employees-number-interstitial", + "content": { + "title": "Employees number interstitial", + "contents": [ + { + "description": { + "text": "The total number of employees confirmed are {answer_employee} , now next question is about training budget", + "placeholders": [ + { + "placeholder": "answer_employee", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "answers", + "identifier": "employees-no" + } + } + } + ] + } + ] + } + } + ] + }, + "type": "Interstitial" + }, + { + "type": "Question", + "id": "employees-training-block", + "question": { + "answers": [ + { + "id": "employees-avg-training", + "mandatory": false, + "decimal_places": 2, + "type": "Currency", + "currency": "GBP", + "label": "Training Budget", + "default": 250 + } + ], + "id": "employees-training-question", + "title": "What is average training budget per employee ?", + "guidance": { + "contents": [ + { + "description": "Leave the text box blank to see the default value on the next page" + } + ] + }, + "type": "General" + } + }, + { + "id": "employees-training-interstitial", + "content": { + "title": "Employee training budget interstitial", + "contents": [ + { + "description": { + "text": "The average training budget per employee is {answer_emp_training}", + "placeholders": [ + { + "placeholder": "answer_emp_training", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "source": "answers", + "identifier": "employees-avg-training" + } + } + } + ] + } + ] + } + } + ] + }, + "type": "Interstitial" + } + ], + "id": "employee-count", + "title": "Employee count" + } + ] + } + ] +} diff --git a/schemas/test/en/test_placeholder_dependencies_with_calculation_summaries.json b/schemas/test/en/test_placeholder_dependencies_with_calculation_summaries.json new file mode 100644 index 0000000000..24e4fe25fb --- /dev/null +++ b/schemas/test/en/test_placeholder_dependencies_with_calculation_summaries.json @@ -0,0 +1,647 @@ +{ + "language": "en", + "mime_type": "application/json/ons/eq", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test placeholder dependencies in calculated summary pages", + "questionnaire_flow": { + "type": "Hub", + "options": { + "required_completed_sections": ["reporting-period-section"] + } + }, + "sections": [ + { + "id": "reporting-period-section", + "title": "Reporting period", + "summary": { + "show_on_completion": false, + "page_title": "Reporting period", + "collapsible": false + }, + "show_on_hub": true, + "groups": [ + { + "id": "reporting-period-group", + "blocks": [ + { + "id": "reporting-date", + "type": "Question", + "question": { + "id": "reporting-date-question", + "title": { + "text": "Are you able to report for the calendar year, {ref_p_start_date} to {ref_p_end_date}?", + "placeholders": [ + { + "placeholder": "ref_p_start_date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "ref_p_end_date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_end_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "reporting-date-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes, I can report for this period", + "value": "Yes, I can report for this period" + }, + { + "label": "No, I need to report for a different period", + "value": "No, I need to report for a different period" + } + ] + } + ] + }, + "page_title": "Calendar year reporting period", + "routing_rules": [ + { + "block": "undertake-rnd", + "when": { + "in": [ + { + "identifier": "reporting-date-answer", + "source": "answers" + }, + ["Yes, I can report for this period"] + ] + } + }, + { + "block": "enter-dates" + } + ] + }, + { + "id": "enter-dates", + "type": "Question", + "question": { + "id": "enter-dates-question", + "title": "What dates will you be reporting for?", + "type": "DateRange", + "answers": [ + { + "id": "date-from", + "type": "Date", + "mandatory": true, + "label": "From" + }, + { + "id": "date-to", + "type": "Date", + "mandatory": true, + "label": "To" + } + ], + "period_limits": { + "minimum": { + "months": 3 + }, + "maximum": { + "months": 18 + } + } + }, + "page_title": "Alternative reporting period" + }, + { + "id": "undertake-rnd", + "type": "Question", + "question": { + "id": "undertake-rnd-question", + "title": "For the reporting period, did your business undertake any in-house R&D?", + "type": "General", + "answers": [ + { + "id": "undertake-rnd-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "page_title": "In-house R&D for reporting period" + } + ] + } + ] + }, + { + "id": "questions-section", + "title": "In-house R&D", + "summary": { + "show_on_completion": false, + "page_title": "In-house R&D", + "collapsible": false + }, + "show_on_hub": true, + "groups": [ + { + "id": "questions-group", + "blocks": [ + { + "id": "how-much-rnd", + "type": "Question", + "question": { + "id": "how-much-rnd-question", + "title": { + "text": "For the period {from} to {to} what was the expenditure on R&D for {ru_name}?", + "placeholders": [ + { + "placeholder": "from", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "identifier": "date-from", + "source": "answers" + }, + { + "source": "metadata", + "identifier": "ref_p_start_date" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "to", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "identifier": "date-to", + "source": "answers" + }, + { + "source": "metadata", + "identifier": "ref_p_end_date" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "ru_name", + "value": { + "source": "metadata", + "identifier": "ru_name" + } + } + ] + }, + "type": "Calculated", + "answers": [ + { + "id": "civil-research", + "mandatory": true, + "type": "Currency", + "label": "Civil Research and Development", + "description": "Enter a value to the nearest thousand (e.g. 56,000).", + "decimal_places": 0, + "currency": "GBP" + }, + { + "id": "defence", + "mandatory": true, + "type": "Currency", + "label": "Defence Research and Development", + "description": "Enter a value to the nearest thousand (e.g. 56,000).", + "decimal_places": 0, + "currency": "GBP" + } + ], + "calculations": [ + { + "calculation_type": "sum", + "answers_to_calculate": ["civil-research", "defence"], + "conditions": ["greater than"], + "value": 0 + } + ] + }, + "page_title": "In-house expenditure on R&D" + }, + { + "id": "calc-summary-1", + "type": "CalculatedSummary", + "page_title": "Total in-house expenditure on R&D", + "title": { + "text": "We have calculated your total in-house expenditure on R&D for {ru_name} for the period {from} to {to} to be %(total)s. Is this correct?", + "placeholders": [ + { + "placeholder": "from", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "identifier": "date-from", + "source": "answers" + }, + { + "source": "metadata", + "identifier": "ref_p_start_date" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "to", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "identifier": "date-to", + "source": "answers" + }, + { + "source": "metadata", + "identifier": "ref_p_end_date" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "ru_name", + "value": { + "source": "metadata", + "identifier": "ru_name" + } + } + ] + }, + "calculation": { + "operation": { + "+": [ + { + "identifier": "civil-research", + "source": "answers" + }, + { + "identifier": "defence", + "source": "answers" + } + ] + }, + "title": "Total in-house expenditure on R&D" + } + }, + { + "id": "how-much-rnd-2", + "type": "Question", + "question": { + "id": "how-much-rnd-question-2", + "title": { + "text": "For the period {from} to {to} what was the expenditure on R&D for {ru_name}?", + "placeholders": [ + { + "placeholder": "from", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "identifier": "date-from", + "source": "answers" + }, + { + "source": "metadata", + "identifier": "ref_p_start_date" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "to", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "identifier": "date-to", + "source": "answers" + }, + { + "source": "metadata", + "identifier": "ref_p_end_date" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "ru_name", + "value": { + "source": "metadata", + "identifier": "ru_name" + } + } + ] + }, + "type": "Calculated", + "answers": [ + { + "id": "innovation", + "mandatory": true, + "type": "Currency", + "label": "Innovation", + "description": "Enter a value to the nearest thousand (e.g. 56,000).", + "decimal_places": 0, + "currency": "GBP" + }, + { + "id": "software", + "mandatory": true, + "type": "Currency", + "label": "Software Development", + "description": "Enter a value to the nearest thousand (e.g. 56,000).", + "decimal_places": 0, + "currency": "GBP" + } + ], + "calculations": [ + { + "calculation_type": "sum", + "answers_to_calculate": ["innovation", "software"], + "conditions": ["greater than"], + "value": 0 + } + ] + }, + "page_title": "In-house expenditure on R&D" + }, + { + "id": "calc-summary-2", + "type": "CalculatedSummary", + "page_title": "Total in-house expenditure on R&D - Part Two", + "title": { + "text": "We have calculated your total in-house expenditure on R&D for {ru_name} for the period {from} to {to} to be %(total)s. Is this correct?", + "placeholders": [ + { + "placeholder": "from", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "identifier": "date-from", + "source": "answers" + }, + { + "source": "metadata", + "identifier": "ref_p_start_date" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "to", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "identifier": "date-to", + "source": "answers" + }, + { + "source": "metadata", + "identifier": "ref_p_end_date" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "ru_name", + "value": { + "source": "metadata", + "identifier": "ru_name" + } + } + ] + }, + "calculation": { + "operation": { + "+": [ + { + "identifier": "innovation", + "source": "answers" + }, + { + "identifier": "software", + "source": "answers" + } + ] + }, + "title": "Total in-house expenditure on R&D - Part Two" + } + }, + { + "type": "GrandCalculatedSummary", + "id": "rnd-grand-calculated-summary", + "title": "We have calculated the grand total of in-house expenditure on R&D to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "calculated_summary", + "identifier": "calc-summary-1" + }, + { + "source": "calculated_summary", + "identifier": "calc-summary-2" + } + ] + }, + "title": "Grand Total in-house expenditure on R&D" + } + } + ] + } + ], + "enabled": { + "when": { + "in": [ + { + "identifier": "undertake-rnd-answer", + "source": "answers" + }, + ["Yes"] + ] + } + } + } + ], + "theme": "business", + "navigation": { + "visible": false + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "ru_ref", + "type": "string" + }, + { + "name": "trad_as", + "type": "string", + "optional": true + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ref_p_start_date", + "type": "date" + }, + { + "name": "ref_p_end_date", + "type": "date" + } + ] +} diff --git a/schemas/test/en/test_placeholder_difference_in_years.json b/schemas/test/en/test_placeholder_difference_in_years.json new file mode 100644 index 0000000000..ab633d7326 --- /dev/null +++ b/schemas/test/en/test_placeholder_difference_in_years.json @@ -0,0 +1,127 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "023", + "title": "Difference between two dates", + "description": "A test schema for calculate age from date", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "dates", + "title": "Date Difference", + "blocks": [ + { + "type": "Question", + "id": "age-block", + "question": { + "id": "date-pipe-question", + "title": "What is your date of birth?", + "type": "General", + "answers": [ + { + "id": "date-dob", + "label": "For example 20 March 1990", + "mandatory": true, + "type": "Date" + } + ] + } + }, + { + "type": "ConfirmationQuestion", + "id": "age-test", + "question": { + "id": "confirm-dob-question", + "title": { + "text": "You are {age} old. Is this correct?", + "placeholders": [ + { + "placeholder": "age", + "transforms": [ + { + "transform": "calculate_date_difference", + "arguments": { + "first_date": { + "source": "answers", + "identifier": "date-dob" + }, + "second_date": { + "value": "now" + } + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "date-test-answer", + "label": "Piped dates", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "age-block", + "when": { + "==": [ + { + "source": "answers", + "identifier": "date-test-answer" + }, + "No" + ] + } + }, + { + "section": "End" + } + ] + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_placeholder_difference_in_years_month_year.json b/schemas/test/en/test_placeholder_difference_in_years_month_year.json new file mode 100644 index 0000000000..e25029ffdf --- /dev/null +++ b/schemas/test/en/test_placeholder_difference_in_years_month_year.json @@ -0,0 +1,127 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "023", + "title": "Difference between two dates", + "description": "A test schema for calculate age from date", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "dates", + "title": "Date Difference", + "blocks": [ + { + "type": "Question", + "id": "age-block", + "question": { + "id": "date-pipe-question", + "title": "When did you last go on holiday?", + "type": "General", + "answers": [ + { + "id": "date-dob", + "label": "For example March 1990", + "mandatory": true, + "type": "MonthYearDate" + } + ] + } + }, + { + "type": "ConfirmationQuestion", + "id": "age-test", + "question": { + "id": "confirm-dob-question", + "title": { + "text": "It has been {age} since you last went on holiday. Is this correct?", + "placeholders": [ + { + "placeholder": "age", + "transforms": [ + { + "transform": "calculate_date_difference", + "arguments": { + "first_date": { + "source": "answers", + "identifier": "date-dob" + }, + "second_date": { + "value": "now" + } + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "date-test-answer", + "label": "Piped dates", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "age-block", + "when": { + "==": [ + { + "source": "answers", + "identifier": "date-test-answer" + }, + "No" + ] + } + }, + { + "section": "End" + } + ] + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_placeholder_difference_in_years_month_year_range.json b/schemas/test/en/test_placeholder_difference_in_years_month_year_range.json new file mode 100644 index 0000000000..61071e78ee --- /dev/null +++ b/schemas/test/en/test_placeholder_difference_in_years_month_year_range.json @@ -0,0 +1,134 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "023", + "title": "Difference between two dates", + "description": "A test schema for calculate age from date", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "dates", + "title": "Date Difference", + "blocks": [ + { + "type": "Question", + "id": "date-block", + "question": { + "id": "date-pipe-question", + "title": "How long were you outside the UK?", + "type": "DateRange", + "answers": [ + { + "mandatory": true, + "label": "From", + "id": "period-from", + "type": "MonthYearDate" + }, + { + "mandatory": true, + "label": "To", + "id": "period-to", + "type": "MonthYearDate" + } + ] + } + }, + { + "type": "ConfirmationQuestion", + "id": "age-test", + "question": { + "id": "confirm-dob-question", + "title": { + "text": "You were out of the UK for {time_away}. Is this correct?", + "placeholders": [ + { + "placeholder": "time_away", + "transforms": [ + { + "transform": "calculate_date_difference", + "arguments": { + "first_date": { + "source": "answers", + "identifier": "period-from" + }, + "second_date": { + "source": "answers", + "identifier": "period-to" + } + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "date-test-answer", + "label": "Piped dates", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "date-block", + "when": { + "==": [ + { + "source": "answers", + "identifier": "date-test-answer" + }, + "No" + ] + } + }, + { + "section": "End" + } + ] + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_placeholder_difference_in_years_range.json b/schemas/test/en/test_placeholder_difference_in_years_range.json new file mode 100644 index 0000000000..35f2356af4 --- /dev/null +++ b/schemas/test/en/test_placeholder_difference_in_years_range.json @@ -0,0 +1,134 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "023", + "title": "Difference between two dates", + "description": "A test schema for calculate age from date", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "dates", + "title": "Date Difference", + "blocks": [ + { + "type": "Question", + "id": "date-block", + "question": { + "id": "date-pipe-question", + "title": "How long were you outside the UK?", + "type": "DateRange", + "answers": [ + { + "mandatory": true, + "label": "From", + "id": "period-from", + "type": "Date" + }, + { + "mandatory": true, + "label": "To", + "id": "period-to", + "type": "Date" + } + ] + } + }, + { + "type": "ConfirmationQuestion", + "id": "age-test", + "question": { + "id": "confirm-dob-question", + "title": { + "text": "You were out of the UK for {time_away}. Is this correct?", + "placeholders": [ + { + "placeholder": "time_away", + "transforms": [ + { + "transform": "calculate_date_difference", + "arguments": { + "first_date": { + "source": "answers", + "identifier": "period-from" + }, + "second_date": { + "source": "answers", + "identifier": "period-to" + } + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "date-test-answer", + "label": "Piped dates", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "date-block", + "when": { + "==": [ + { + "source": "answers", + "identifier": "date-test-answer" + }, + "No" + ] + } + }, + { + "section": "End" + } + ] + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_placeholder_first_non_empty_item.json b/schemas/test/en/test_placeholder_first_non_empty_item.json new file mode 100644 index 0000000000..a0c6d6e8df --- /dev/null +++ b/schemas/test/en/test_placeholder_first_non_empty_item.json @@ -0,0 +1,275 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Other input fields", + "theme": "default", + "description": "Questionnaire to check placeholder takes account answers on a path", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "ru_ref", + "type": "string" + }, + { + "name": "trad_as", + "type": "string", + "optional": true + }, + { + "name": "ref_p_start_date", + "type": "date" + }, + { + "name": "ref_p_end_date", + "type": "date" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "default-group", + "blocks": [ + { + "id": "date-question-block", + "type": "Question", + "question": { + "id": "date-question", + "title": { + "text": "Are you able to report for the period from {ref_p_start_date} to {ref_p_end_date}?", + "placeholders": [ + { + "placeholder": "ref_p_start_date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "ref_p_end_date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_end_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "date-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes, I can report for this period", + "value": "Yes, I can report for this period" + }, + { + "label": "No, I need to report for a different period", + "value": "No, I need to report for a different period" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "total-turnover-block", + "when": { + "in": [ + { + "identifier": "date-answer", + "source": "answers" + }, + ["Yes, I can report for this period"] + ] + } + }, + { + "block": "date-entry-block" + } + ] + }, + { + "id": "date-entry-block", + "type": "Question", + "question": { + "id": "date-entry-question", + "title": "What are the dates of the period that you will be reporting for?", + "guidance": { + "contents": [ + { + "description": "Enter a date between 1st of May 2016 and the 31st of May 2016" + } + ] + }, + "type": "DateRange", + "answers": [ + { + "id": "date-entry-answer-from", + "type": "Date", + "mandatory": true, + "label": "From", + "minimum": { + "value": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "offset_by": { + "days": -19 + } + } + }, + { + "id": "date-entry-answer-to", + "type": "Date", + "mandatory": true, + "label": "To", + "maximum": { + "value": { + "source": "metadata", + "identifier": "ref_p_end_date" + }, + "offset_by": { + "days": 20 + } + } + } + ] + } + }, + { + "id": "total-turnover-block", + "type": "Question", + "question": { + "id": "total-turnover-question", + "title": { + "text": "For the period {date_entry_answer_from} to {date_entry_answer_to}, what was {ru_name}'s total turnover, excluding VAT?", + "placeholders": [ + { + "placeholder": "date_entry_answer_from", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "answers", + "identifier": "date-entry-answer-from" + }, + { + "source": "metadata", + "identifier": "ref_p_start_date" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "date_entry_answer_to", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "answers", + "identifier": "date-entry-answer-to" + }, + { + "source": "metadata", + "identifier": "ref_p_end_date" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "ru_name", + "value": { + "source": "metadata", + "identifier": "ru_name" + } + } + ] + }, + "type": "General", + "answers": [ + { + "id": "total-turnover-answer", + "mandatory": true, + "type": "Currency", + "label": "Total turnover excluding VAT", + "description": "Enter the full value (e.g. 56,234.33) or a value to the nearest £thousand (e.g. 56,000). Do not enter '56' for £56,000.", + "decimal_places": 2, + "currency": "GBP" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_placeholder_first_non_empty_item_cross_section_dependencies.json b/schemas/test/en/test_placeholder_first_non_empty_item_cross_section_dependencies.json new file mode 100644 index 0000000000..ec3c2f1734 --- /dev/null +++ b/schemas/test/en/test_placeholder_first_non_empty_item_cross_section_dependencies.json @@ -0,0 +1,283 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Other input fields", + "theme": "default", + "description": "Questionnaire to check placeholder takes account answers on a path with cross section dependencies", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "ru_ref", + "type": "string" + }, + { + "name": "trad_as", + "type": "string", + "optional": true + }, + { + "name": "ref_p_start_date", + "type": "date" + }, + { + "name": "ref_p_end_date", + "type": "date" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "default-section", + "title": "Date Selection", + "groups": [ + { + "id": "default-group", + "blocks": [ + { + "id": "date-question-block", + "type": "Question", + "question": { + "id": "date-question", + "title": { + "text": "Are you able to report for the period from {ref_p_start_date} to {ref_p_end_date}?", + "placeholders": [ + { + "placeholder": "ref_p_start_date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "ref_p_end_date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_end_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "date-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes, I can report for this period", + "value": "Yes, I can report for this period" + }, + { + "label": "No, I need to report for a different period", + "value": "No, I need to report for a different period" + } + ] + } + ] + }, + "routing_rules": [ + { + "section": "End", + "when": { + "in": [ + { + "identifier": "date-answer", + "source": "answers" + }, + ["Yes, I can report for this period"] + ] + } + }, + { + "block": "date-entry-block" + } + ] + }, + { + "id": "date-entry-block", + "type": "Question", + "question": { + "id": "date-entry-question", + "title": "What are the dates of the period that you will be reporting for?", + "guidance": { + "contents": [ + { + "description": "Enter a date between 1st of May 2016 and the 31st of May 2016" + } + ] + }, + "type": "DateRange", + "answers": [ + { + "id": "date-entry-answer-from", + "type": "Date", + "mandatory": true, + "label": "From", + "minimum": { + "value": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "offset_by": { + "days": -19 + } + } + }, + { + "id": "date-entry-answer-to", + "type": "Date", + "mandatory": true, + "label": "To", + "maximum": { + "value": { + "source": "metadata", + "identifier": "ref_p_end_date" + }, + "offset_by": { + "days": 20 + } + } + } + ] + } + } + ] + } + ] + }, + { + "id": "second-section", + "title": "Food Expenses", + "groups": [ + { + "id": "second-section-group", + "blocks": [ + { + "id": "food-question-block", + "type": "Question", + "question": { + "id": "food-question", + "title": { + "text": "For the period {date_entry_answer_from} to {date_entry_answer_to}, how much do you spend on food?", + "placeholders": [ + { + "placeholder": "date_entry_answer_from", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "answers", + "identifier": "date-entry-answer-from" + }, + { + "source": "metadata", + "identifier": "ref_p_start_date" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "date_entry_answer_to", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "answers", + "identifier": "date-entry-answer-to" + }, + { + "source": "metadata", + "identifier": "ref_p_end_date" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "ru_name", + "value": { + "source": "metadata", + "identifier": "ru_name" + } + } + ] + }, + "type": "General", + "answers": [ + { + "id": "food-answer", + "mandatory": true, + "type": "Currency", + "label": "Total food expense", + "description": "Enter the full value (e.g. 32.33) or a value to the nearest £thousand (e.g. 56,000). Do not enter '56' for £56,000.", + "decimal_places": 2, + "currency": "GBP" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_placeholder_first_non_empty_item_repeating_sections.json b/schemas/test/en/test_placeholder_first_non_empty_item_repeating_sections.json new file mode 100644 index 0000000000..5feccb91fd --- /dev/null +++ b/schemas/test/en/test_placeholder_first_non_empty_item_repeating_sections.json @@ -0,0 +1,528 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test first non empty item with repeating sections", + "theme": "default", + "description": "Questionnaire to test first non empty item with repeating sections", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "ref_p_start_date", + "type": "date" + }, + { + "name": "ref_p_end_date", + "type": "date" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "date-section", + "title": "Date Range", + "groups": [ + { + "id": "date-group", + "blocks": [ + { + "id": "date-question-block", + "type": "Question", + "question": { + "id": "date-question", + "title": { + "text": "Are you able to report for the period from {ref_p_start_date} to {ref_p_end_date}?", + "placeholders": [ + { + "placeholder": "ref_p_start_date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "ref_p_end_date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "ref_p_end_date" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "date-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes, I can report for this period", + "value": "Yes, I can report for this period" + }, + { + "label": "No, I need to report for a different period", + "value": "No, I need to report for a different period" + } + ] + } + ] + }, + "routing_rules": [ + { + "section": "End", + "when": { + "in": [ + { + "identifier": "date-answer", + "source": "answers" + }, + ["Yes, I can report for this period"] + ] + } + }, + { + "block": "date-entry-block" + } + ] + }, + { + "id": "date-entry-block", + "type": "Question", + "question": { + "id": "date-entry-question", + "title": "What are the dates of the period that you will be reporting for?", + "guidance": { + "contents": [ + { + "description": "Enter a date between 1st of May 2016 and the 31st of May 2016" + } + ] + }, + "type": "DateRange", + "answers": [ + { + "id": "date-entry-answer-from", + "type": "Date", + "mandatory": true, + "label": "From", + "minimum": { + "value": { + "source": "metadata", + "identifier": "ref_p_start_date" + }, + "offset_by": { + "days": -19 + } + } + }, + { + "id": "date-entry-answer-to", + "type": "Date", + "mandatory": true, + "label": "To", + "maximum": { + "value": { + "source": "metadata", + "identifier": "ref_p_end_date" + }, + "offset_by": { + "days": 20 + } + } + } + ] + } + } + ] + } + ] + }, + { + "id": "list-collector-section", + "title": "List Collector Section", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": "Household members", + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "title": { + "text": "Between {date_entry_answer_from} to {date_entry_answer_to} did anyone else live here?", + "placeholders": [ + { + "placeholder": "date_entry_answer_from", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "answers", + "identifier": "date-entry-answer-from" + }, + { + "source": "metadata", + "identifier": "ref_p_start_date" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "date_entry_answer_to", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "answers", + "identifier": "date-entry-answer-to" + }, + { + "source": "metadata", + "identifier": "ref_p_end_date" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "cancel_text": "Don’t need to add anyone else?", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "cancel_text": "Don’t need to change anything?", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "cancel_text": "Don’t need to remove this person?", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "warning": "All of the information about this person will be deleted", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "repeating-section", + "title": "Personal Details", + "summary": { "show_on_completion": true }, + "repeat": { + "for_list": "people", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "groups": [ + { + "id": "personal-details-group", + "title": "Personal Details", + "blocks": [ + { + "type": "Question", + "id": "personal-details-block", + "question": { + "type": "General", + "id": "personal-details-question", + "title": { + "text": "Between {date_entry_answer_from} to {date_entry_answer_to} what did you drink the most?", + "placeholders": [ + { + "placeholder": "date_entry_answer_from", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "answers", + "identifier": "date-entry-answer-from" + }, + { + "source": "metadata", + "identifier": "ref_p_start_date" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + }, + { + "placeholder": "date_entry_answer_to", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "answers", + "identifier": "date-entry-answer-to" + }, + { + "source": "metadata", + "identifier": "ref_p_end_date" + } + ] + } + }, + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "previous_transform" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "answers": [ + { + "id": "personal-details-answer", + "mandatory": true, + "options": [ + { + "label": "Coffee", + "value": "Coffee" + }, + { + "label": "Tea", + "value": "Tea" + } + ], + "type": "Checkbox" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_placeholder_full.json b/schemas/test/en/test_placeholder_full.json new file mode 100644 index 0000000000..8218e923af --- /dev/null +++ b/schemas/test/en/test_placeholder_full.json @@ -0,0 +1,341 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Placeholder Test", + "theme": "default", + "description": "A questionnaire to test placeholders", + "navigation": { + "visible": true + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "display_address", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "name-section", + "title": "Name Input", + "groups": [ + { + "id": "name-group", + "blocks": [ + { + "type": "Question", + "id": "name-question", + "question": { + "id": "primary-name-question", + "title": "Please enter a name", + "type": "General", + "answers": [ + { + "id": "first-name", + "label": "First Name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last Name", + "mandatory": false, + "type": "TextField" + } + ] + } + } + ] + } + ] + }, + { + "id": "age-input-section", + "title": "Age Input", + "groups": [ + { + "id": "dob-input-group", + "blocks": [ + { + "type": "Question", + "id": "dob-question-block", + "question": { + "id": "dob-question", + "title": { + "text": "What is {person_name_possessive} date of birth?", + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "date-of-birth-answer", + "description": "Enter your date of birth", + "label": "Date of Birth", + "mandatory": true, + "type": "Date" + } + ] + } + } + ] + } + ] + }, + { + "id": "age-confirmation-section", + "title": "Age Confirmation", + "groups": [ + { + "blocks": [ + { + "type": "ConfirmationQuestion", + "id": "confirm-dob-proxy", + "question": { + "id": "confirm-date-of-birth-proxy", + "title": { + "text": "{person_name} is {age} old. Is this correct?", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "age", + "transforms": [ + { + "transform": "calculate_date_difference", + "arguments": { + "first_date": { + "source": "answers", + "identifier": "date-of-birth-answer" + }, + "second_date": { + "value": "now" + } + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "confirm-date-of-birth-answer-proxy", + "mandatory": true, + "options": [ + { + "label": { + "text": "Yes, {person_name} is {age} old.", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "age", + "transforms": [ + { + "transform": "calculate_date_difference", + "arguments": { + "first_date": { + "source": "answers", + "identifier": "date-of-birth-answer" + }, + "second_date": { + "value": "now" + } + } + } + ] + } + ] + }, + "value": "Yes, {person_name} is {age} old." + }, + { + "label": "No, I need to change their date of birth", + "value": "No, I need to change their date of birth" + } + ], + "type": "Radio" + } + ] + }, + "routing_rules": [ + { + "group": "dob-input-group", + "when": { + "==": [ + { + "source": "answers", + "identifier": "confirm-date-of-birth-answer-proxy" + }, + "No, I need to change their date of birth" + ] + } + }, + { + "section": "End" + } + ] + } + ], + "id": "group" + } + ] + }, + { + "id": "mutually-exclusive-checkbox-section", + "title": "Checkbox", + "groups": [ + { + "id": "mutually-exclusive-mandatory-group", + "blocks": [ + { + "type": "Question", + "id": "mutually-exclusive-checkbox", + "question": { + "id": "mutually-exclusive-checkbox-question", + "type": "MutuallyExclusive", + "title": "Were you a resident at any of the following addresses?", + "mandatory": true, + "answers": [ + { + "id": "checkbox-answer", + "instruction": "Select an answer", + "type": "Checkbox", + "mandatory": false, + "options": [ + { + "label": { + "placeholders": [ + { + "placeholder": "household_address", + "value": { + "identifier": "display_address", + "source": "metadata" + } + } + ], + "text": "{household_address}" + }, + "value": "{household_address}" + }, + { + "label": "7 Evelyn Street, Barry", + "value": "7 Evelyn Street, Barry" + }, + { + "label": "251 Argae Lane, Barry", + "value": "251 Argae Lane, Barry" + } + ] + }, + { + "id": "checkbox-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "description": "Some description", + "value": "I prefer not to say" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_placeholder_metadata.json b/schemas/test/en/test_placeholder_metadata.json new file mode 100644 index 0000000000..c34f90eede --- /dev/null +++ b/schemas/test/en/test_placeholder_metadata.json @@ -0,0 +1,85 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test placeholder metadata", + "theme": "default", + "description": "A questionnaire to demo placeholder metadata", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "mandatory-radio", + "question": { + "type": "General", + "id": "mandatory-radio-question", + "title": "Who is the respondent of your business ?", + "answers": [ + { + "type": "Radio", + "id": "mandatory-radio-answer", + "mandatory": true, + "options": [ + { + "label": { + "text": "{ru_name}", + "placeholders": [ + { + "placeholder": "ru_name", + "value": { + "source": "metadata", + "identifier": "ru_name" + } + } + ] + }, + "value": "{ru_name}" + }, + { + "label": "Google LTD", + "value": "Google LTD" + }, + { + "label": "Meta LTD", + "value": "Meta LTD" + } + ] + } + ] + } + } + ], + "id": "checkboxes" + } + ] + } + ] +} diff --git a/schemas/test/en/test_placeholder_option_label_from_value.json b/schemas/test/en/test_placeholder_option_label_from_value.json new file mode 100644 index 0000000000..79102c41e6 --- /dev/null +++ b/schemas/test/en/test_placeholder_option_label_from_value.json @@ -0,0 +1,151 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test option label from value", + "theme": "default", + "description": "A questionnaire to demo the piping of Checkbox/Radio answer options", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "trad_as", + "type": "string", + "optional": true + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "checkbox-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "mandatory-radio", + "question": { + "type": "General", + "id": "mandatory-radio-question", + "title": "What is the trade name of your business ?", + "guidance": { + "contents": [ + { + "description": "First option is piped from metadata" + } + ] + }, + "answers": [ + { + "type": "Radio", + "id": "mandatory-radio-answer", + "mandatory": true, + "options": [ + { + "label": { + "text": "{business_name} (piped)", + "placeholders": [ + { + "placeholder": "business_name", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "metadata", + "identifier": "trad_as" + } + ] + } + } + ] + } + ] + }, + "value": "{business_name} (piped)" + }, + { + "label": "Google LTD", + "value": "Google LTD" + }, + { + "label": "Meta LTD", + "value": "Meta LTD" + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "confirmation-question-radio-block", + "question": { + "id": "confirmation-question-radio", + "title": { + "text": "You chose {business_name} as your business name, is that correct ?", + "placeholders": [ + { + "placeholder": "business_name", + "transforms": [ + { + "transform": "option_label_from_value", + "arguments": { + "value": { + "source": "answers", + "identifier": "mandatory-radio-answer" + }, + "answer_id": "mandatory-radio-answer" + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "type": "Radio", + "id": "confirm-business-radio-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + } + ], + "id": "checkboxes" + } + ] + } + ] +} diff --git a/schemas/test/en/test_placeholder_playback_list.json b/schemas/test/en/test_placeholder_playback_list.json new file mode 100644 index 0000000000..6844986e74 --- /dev/null +++ b/schemas/test/en/test_placeholder_playback_list.json @@ -0,0 +1,164 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Other input fields", + "theme": "default", + "description": "A questionnaire to demo checkbox field Other input.", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "mandatory-checkbox", + "question": { + "answers": [ + { + "id": "mandatory-checkbox-answer", + "mandatory": true, + "options": [ + { + "label": "None", + "value": "None" + }, + { + "label": "Cheese", + "value": "Cheese" + }, + { + "label": "Ham", + "value": "Ham" + }, + { + "label": "Pineapple", + "value": "Pineapple" + }, + { + "label": "Tuna", + "value": "Tuna" + }, + { + "label": "Pepperoni", + "value": "Pepperoni" + }, + { + "label": "Other", + "description": "Choose any other topping", + "value": "Other", + "detail_answer": { + "mandatory": true, + "id": "other-answer-mandatory", + "label": "Please specify other", + "type": "TextField" + } + } + ], + "type": "Checkbox", + "validation": { + "messages": {} + } + } + ], + "id": "mandatory-checkbox-question", + "title": "Which pizza toppings would you like?", + "type": "General" + } + }, + { + "type": "ConfirmationQuestion", + "id": "confirm-answers-block", + "question": { + "type": "General", + "answers": [ + { + "type": "Radio", + "id": "confirm-answers", + "options": [ + { + "label": "Yes this is correct", + "value": "Yes this is correct" + }, + { + "label": "No I need to change this", + "value": "No I need to change this" + } + ], + "mandatory": true + } + ], + "id": "confirm-answers-question", + "title": "You selected the following toppings. Is this correct?", + "description": [ + { + "text": "{toppings}", + "placeholders": [ + { + "placeholder": "toppings", + "transforms": [ + { + "transform": "format_list", + "arguments": { + "list_to_format": { + "source": "answers", + "identifier": "mandatory-checkbox-answer" + } + } + } + ] + } + ] + } + ] + }, + "routing_rules": [ + { + "when": { + "==": [ + { + "source": "answers", + "identifier": "confirm-answers" + }, + "No I need to change this" + ] + }, + "block": "mandatory-checkbox" + }, + { + "section": "End" + } + ] + } + ], + "id": "checkboxes" + } + ] + } + ] +} diff --git a/schemas/test/en/test_placeholder_transform.json b/schemas/test/en/test_placeholder_transform.json new file mode 100644 index 0000000000..78f2bfb63e --- /dev/null +++ b/schemas/test/en/test_placeholder_transform.json @@ -0,0 +1,336 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Placeholder Test", + "theme": "default", + "description": "A questionnaire to test placeholders", + "navigation": { + "visible": true + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "trad_as", + "type": "string", + "optional": true + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "retail-turnover-section", + "title": "Retail Turnover Input", + "groups": [ + { + "id": "retail-turnover-group", + "blocks": [ + { + "type": "Question", + "id": "total-retail-turnover-block", + "question": { + "id": "total-retail-turnover-question", + "title": { + "text": "For {ru_name}{conditional_trad_as}, please enter the total retail turnover", + "placeholders": [ + { + "placeholder": "conditional_trad_as", + "transforms": [ + { + "arguments": { + "trad_as": { + "source": "metadata", + "identifier": "trad_as" + } + }, + "transform": "conditional_trad_as" + } + ] + }, + { + "placeholder": "ru_name", + "value": { + "source": "metadata", + "identifier": "ru_name" + } + } + ] + }, + "type": "General", + "answers": [ + { + "id": "total-retail-turnover-answer", + "label": "Total Retail Turnover", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + } + ] + } + ] + }, + { + "id": "percent-input-section", + "title": "Reporting Confirmation", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "report-period", + "question": { + "type": "General", + "id": "total-retail-turnover-confirmation-question", + "title": "Please enter the value of internet sales", + "description": [ + { + "text": "Of the {total_turnover} total retail turnover, what was the value of internet sales?", + "placeholders": [ + { + "placeholder": "total_turnover", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "source": "answers", + "identifier": "total-retail-turnover-answer" + } + } + } + ] + } + ] + } + ], + "answers": [ + { + "id": "total-retail-turnover-internet-sales-answer", + "label": "Value of Internet Sales", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + } + ], + "id": "retail-confirmation-group" + } + ] + }, + { + "id": "total-items", + "title": "Total Amount of Items", + "groups": [ + { + "id": "total-items-group", + "blocks": [ + { + "type": "Question", + "id": "total-items-block", + "question": { + "id": "total-items-question", + "title": "Please enter the number of items", + "type": "General", + "answers": [ + { + "id": "total-items-answer", + "label": "Number of Items", + "mandatory": false, + "type": "Number", + "default": 0 + } + ] + } + }, + { + "id": "add-item", + "question": { + "answers": [ + { + "id": "add-item-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "add-item-question", + "title": { + "placeholders": [ + { + "placeholder": "item", + "transforms": [ + { + "transform": "add", + "arguments": { + "lhs": { + "source": "answers", + "identifier": "total-items-answer" + }, + "rhs": { + "value": 1 + } + } + }, + { + "arguments": { + "number_to_format": { + "source": "previous_transform" + }, + "determiner": { + "value": "a_or_an" + } + }, + "transform": "format_ordinal" + } + ] + } + ], + "text": "Do you want to add {item} item?" + }, + "type": "General" + }, + "type": "Question" + }, + { + "type": "Question", + "id": "training-percentage-block", + "question": { + "answers": [ + { + "id": "training-percentage", + "mandatory": false, + "decimal_places": 0, + "type": "Percentage", + "label": "Percentage of company budget", + "default": 0 + } + ], + "id": "training-percentage-question", + "title": "What percentage of the company budget you spend on training ?", + "type": "General" + } + }, + { + "id": "training-percentage-interstitial", + "content": { + "title": "Percentage of budget spent on training interstitial", + "contents": [ + { + "description": { + "text": "The percentage of the company budget you spend on training is {answer_percentage}", + "placeholders": [ + { + "placeholder": "answer_percentage", + "transforms": [ + { + "transform": "format_percentage", + "arguments": { + "value": { + "source": "answers", + "identifier": "training-percentage" + } + } + } + ] + } + ] + } + } + ] + }, + "type": "Interstitial" + }, + { + "type": "Question", + "id": "average-distance-block", + "question": { + "answers": [ + { + "id": "average-distance", + "mandatory": false, + "unit": "length-mile", + "type": "Unit", + "unit_length": "long", + "label": "Average commuting distance", + "default": 0 + } + ], + "id": "average-distance-question", + "title": "What is the average commuting distance of an employee (in miles) ?", + "type": "General" + } + }, + { + "id": "average-distance-interstitial", + "content": { + "title": "Average commuting distance interstitial", + "contents": [ + { + "description": { + "text": "The average commuting distance of an employee is {answer_distance}", + "placeholders": [ + { + "placeholder": "answer_distance", + "transforms": [ + { + "transform": "format_unit", + "arguments": { + "value": { + "source": "answers", + "identifier": "average-distance" + }, + "unit": "length-mile", + "unit_length": "long" + } + } + ] + } + ] + } + } + ] + }, + "type": "Interstitial" + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_placeholder_transform_date_range_bounds.json b/schemas/test/en/test_placeholder_transform_date_range_bounds.json new file mode 100644 index 0000000000..f6092b1a37 --- /dev/null +++ b/schemas/test/en/test_placeholder_transform_date_range_bounds.json @@ -0,0 +1,174 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Other input fields", + "theme": "default", + "description": "A questionnaire to test date_range_bounds and format_date_range", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "days-worked-section", + "title": "Days Input", + "groups": [ + { + "id": "days-input-group", + "blocks": [ + { + "type": "Question", + "id": "date-question", + "question": { + "id": "primary-date-question", + "title": "Please enter a reference date to generate a date range", + "type": "General", + "answers": [ + { + "id": "reference-date", + "label": "Reference Date", + "description": "This scenario uses 1 prior full week offset, 15 day range, first day of the week monday", + "mandatory": true, + "type": "Date" + } + ] + } + }, + { + "type": "Question", + "id": "days-question-block", + "question": { + "id": "days-question", + "title": { + "text": "How many days did you work between {formatted_date_range}?", + "placeholders": [ + { + "placeholder": "formatted_date_range", + "transforms": [ + { + "transform": "date_range_bounds", + "arguments": { + "reference_date": { + "source": "answers", + "identifier": "reference-date" + }, + "offset_full_weeks": -1, + "days_in_range": 15, + "first_day_of_week": "MONDAY" + } + }, + { + "arguments": { + "date_range": { + "source": "previous_transform" + } + }, + "transform": "format_date_range" + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "days-worked-answer", + "label": "Days worked", + "description": "This scenario uses 1 prior full week offset, 15 day range, first day of the week monday", + "mandatory": false, + "type": "Number" + } + ] + } + }, + { + "id": "block0", + "type": "Question", + "question": { + "id": "question0", + "title": "Title", + "type": "General", + "answers": [ + { + "id": "ref-answer0", + "mandatory": true, + "type": "Date", + "label": "Start of a date range" + }, + { + "id": "ref-answer1", + "mandatory": true, + "type": "Date", + "label": "End of a date range" + } + ] + } + }, + { + "type": "Question", + "id": "range-question-block", + "question": { + "id": "range-question", + "title": { + "text": "This is a formatted date range: {formatted_date_range}", + "placeholders": [ + { + "placeholder": "formatted_date_range", + "transforms": [ + { + "transform": "format_date_range", + "arguments": { + "date_range": [ + { + "source": "answers", + "identifier": "ref-answer0" + }, + { + "source": "answers", + "identifier": "ref-answer1" + } + ] + } + } + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "date-range-answer", + "label": "How many days did you work during this period?", + "mandatory": false, + "type": "Number" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_plural_forms.json b/schemas/test/en/test_plural_forms.json new file mode 100644 index 0000000000..ab0833d74c --- /dev/null +++ b/schemas/test/en/test_plural_forms.json @@ -0,0 +1,135 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Plural Forms", + "theme": "default", + "description": "A questionnaire to test different forms of plurals", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "plural-section", + "title": "Test Plural Section", + "groups": [ + { + "id": "plural-group", + "title": "Test Plurals", + "blocks": [ + { + "type": "Question", + "id": "number-of-people-block", + "question": { + "answers": [ + { + "id": "number-of-people-answer", + "label": "How many people live here?", + "mandatory": true, + "type": "Number", + "minimum": { + "value": 0 + }, + "maximum": { + "value": 100 + } + } + ], + "id": "number-of-people-question", + "title": "Title", + "type": "General" + } + }, + { + "type": "Question", + "id": "confirm-number-of-people", + "question": { + "type": "General", + "id": "total-people-question", + "title": { + "text_plural": { + "forms": { + "one": "{number_of_people} person lives here, is this correct?", + "other": "{number_of_people} people live here, is this correct?" + }, + "count": { + "source": "answers", + "identifier": "number-of-people-answer" + } + }, + "placeholders": [ + { + "placeholder": "number_of_people", + "value": { + "source": "answers", + "identifier": "number-of-people-answer" + } + } + ] + }, + "answers": [ + { + "id": "confirm-count", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": { + "text_plural": { + "forms": { + "one": "Yes, {number_of_people} person lives here", + "other": "Yes, {number_of_people} people live here" + }, + "count": { + "source": "answers", + "identifier": "number-of-people-answer" + } + }, + "placeholders": [ + { + "placeholder": "number_of_people", + "value": { + "source": "answers", + "identifier": "number-of-people-answer" + } + } + ] + }, + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_progress_block_value_source_repeating_sections.json b/schemas/test/en/test_progress_block_value_source_repeating_sections.json new file mode 100644 index 0000000000..764e05b6ea --- /dev/null +++ b/schemas/test/en/test_progress_block_value_source_repeating_sections.json @@ -0,0 +1,392 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "survey_id": "139", + "theme": "default", + "title": "Progress Value Source Repeating Sections Test", + "data_version": "0.0.3", + "description": "Progress Value Source Repeating Sections Test", + "navigation": { + "visible": true + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "trad_as", + "type": "string", + "optional": true + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section-1", + "title": "List collector + random question", + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "type": "Question", + "id": "question-block", + "question": { + "id": "question", + "title": "Question", + "description": ["The next question is used as a dependency in the repeating sections."], + "type": "General", + "answers": [ + { + "id": "answer", + "mandatory": false, + "label": "Enter any number", + "type": "Number" + } + ] + } + }, + { + "type": "Question", + "id": "random-question-enabler-block", + "question": { + "id": "random-question-enabler-question", + "title": "Random question enabler", + "description": [ + "Answering this question will enable the random question in the repeated section coming after the list collector." + ], + "type": "General", + "answers": [ + { + "id": "random-question-enabler-answer", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ] + } + ] + }, + { + "id": "section-2", + "title": "Questions", + "summary": { "show_on_completion": true }, + "repeat": { + "for_list": "people", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "groups": [ + { + "id": "dob-group", + "title": "Date of birth", + "blocks": [ + { + "type": "Question", + "id": "dob-block", + "question": { + "answers": [ + { + "id": "date-of-birth-answer", + "mandatory": false, + "maximum": { + "value": "now" + }, + "minimum": { + "offset_by": { + "years": -115 + }, + "value": "2019-10-13" + }, + "type": "Date" + } + ], + "guidance": { + "contents": [ + { + "description": "For example 31 12 1970" + } + ] + }, + "id": "date-of-birth-question", + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "What is {person_name_possessive} date of birth?" + }, + "type": "General" + } + }, + { + "type": "Question", + "id": "other-question-block", + "question": { + "id": "other-question", + "answers": [ + { + "id": "other-answer", + "mandatory": true, + "label": "Anything", + "type": "Number" + } + ], + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "Random question about {person_name_possessive}" + }, + "description": ["Shows because the random question was completed in section 1"], + "type": "General" + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "block", + "identifier": "random-question-enabler-block" + }, + "COMPLETED" + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_progress_section_value_source_repeating_sections.json b/schemas/test/en/test_progress_section_value_source_repeating_sections.json new file mode 100644 index 0000000000..dcdfad3364 --- /dev/null +++ b/schemas/test/en/test_progress_section_value_source_repeating_sections.json @@ -0,0 +1,392 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "survey_id": "139", + "theme": "default", + "title": "Progress Value Source Repeating Sections Test", + "data_version": "0.0.3", + "description": "Progress Value Source Repeating Sections Test", + "navigation": { + "visible": true + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "trad_as", + "type": "string", + "optional": true + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section-1", + "title": "List collector + random question", + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "type": "Question", + "id": "question-block", + "question": { + "id": "question", + "title": "Question", + "description": ["The next question is used as a dependency in the repeating sections."], + "type": "General", + "answers": [ + { + "id": "answer", + "mandatory": false, + "label": "Enter any number", + "type": "Number" + } + ] + } + }, + { + "type": "Question", + "id": "random-question-enabler-block", + "question": { + "id": "random-question-enabler-question", + "title": "Random question enabler", + "description": [ + "Answering this question will enable the random question in the repeated section coming after the list collector." + ], + "type": "General", + "answers": [ + { + "id": "random-question-enabler-answer", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ] + } + ] + }, + { + "id": "section-2", + "title": "Questions", + "summary": { "show_on_completion": true }, + "repeat": { + "for_list": "people", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "groups": [ + { + "id": "dob-group", + "title": "Date of birth", + "blocks": [ + { + "type": "Question", + "id": "dob-block", + "question": { + "answers": [ + { + "id": "date-of-birth-answer", + "mandatory": false, + "maximum": { + "value": "now" + }, + "minimum": { + "offset_by": { + "years": -115 + }, + "value": "2019-10-13" + }, + "type": "Date" + } + ], + "guidance": { + "contents": [ + { + "description": "For example 31 12 1970" + } + ] + }, + "id": "date-of-birth-question", + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "What is {person_name_possessive} date of birth?" + }, + "type": "General" + } + }, + { + "type": "Question", + "id": "other-question-block", + "question": { + "id": "other-question", + "answers": [ + { + "id": "other-answer", + "mandatory": true, + "label": "Anything", + "type": "Number" + } + ], + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "Random question about {person_name_possessive}" + }, + "description": ["Shows because the random question was completed in section 1"], + "type": "General" + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-1" + }, + "COMPLETED" + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_progress_value_source_blocks.json b/schemas/test/en/test_progress_value_source_blocks.json new file mode 100644 index 0000000000..3a10d2a382 --- /dev/null +++ b/schemas/test/en/test_progress_value_source_blocks.json @@ -0,0 +1,210 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test progress value source", + "theme": "default", + "description": "A test survey for testing progres value source referencing blocks", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section-1", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "s1-b1", + "question": { + "id": "s1-b1-q1", + "title": "Section 1 Question 1", + "description": [ + "If you answer 0, then the second question will be skipped because of a routing rule, as well as the fourth question because of a skip condition referencing the progress of question 2, as well as the 6th question because of a routing rule referencing the progress of question 4.", + "So only questions 3, 5, 7 will be displayed.", + "Otherwise, questions 2, 4 and 6 can also display." + ], + "type": "General", + "answers": [ + { + "id": "s1-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "routing_rules": [ + { + "when": { + "==": [ + { + "source": "answers", + "identifier": "s1-b1-q1-a1" + }, + 0 + ] + }, + "block": "s1-b3" + }, + { + "block": "s1-b2" + } + ] + }, + { + "type": "Question", + "id": "s1-b2", + "question": { + "id": "s1-b2-q1", + "title": "Section 1 Question 2", + "description": ["Showing this question because question 1 value is not 0"], + "type": "General", + "answers": [ + { + "id": "s1-b2-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + }, + { + "type": "Question", + "id": "s1-b3", + "question": { + "id": "s1-b3-q1", + "title": "Section 1 Question 3", + "type": "General", + "answers": [ + { + "id": "s1-b3-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + }, + { + "type": "Question", + "id": "s1-b4", + "question": { + "id": "s1-b4-q1", + "title": "Section 1 Question 4", + "type": "General", + "answers": [ + { + "id": "s1-b4-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [{ "source": "progress", "selector": "block", "identifier": "s1-b2" }, "COMPLETED"] + } + } + }, + { + "type": "Question", + "id": "s1-b5", + "question": { + "id": "s1-b5-q1", + "title": "Section 1 Question 5", + "type": "General", + "answers": [ + { + "id": "s1-b5-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "routing_rules": [ + { + "when": { + "==": [ + { + "source": "progress", + "selector": "block", + "identifier": "s1-b4" + }, + "COMPLETED" + ] + }, + "block": "s1-b6" + }, + { + "block": "s1-b7" + } + ] + }, + { + "type": "Question", + "id": "s1-b6", + "question": { + "id": "s1-b6-q1", + "title": "Section 1 Question 6", + "description": ["Showing this question because question 4 was completed"], + "type": "General", + "answers": [ + { + "id": "s1-b6-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + }, + { + "type": "Question", + "id": "s1-b7", + "question": { + "id": "s1-b7-q1", + "title": "Section 1 Question 7", + "type": "General", + "answers": [ + { + "id": "s1-b7-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ], + "id": "group-1" + } + ] + } + ] +} diff --git a/schemas/test/en/test_progress_value_source_blocks_cross_section.json b/schemas/test/en/test_progress_value_source_blocks_cross_section.json new file mode 100644 index 0000000000..d8cb40da44 --- /dev/null +++ b/schemas/test/en/test_progress_value_source_blocks_cross_section.json @@ -0,0 +1,224 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test progress value source", + "theme": "default", + "description": "A test survey for testing progres value source referencing blocks", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section-1", + "title": "Section One", + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "s1-b1", + "question": { + "id": "s1-b1-q1", + "title": "Section 1 Question 1", + "description": [ + "If you answer 0, then the second question will be skipped because of a routing rule, as well as the fourth question because of a skip condition referencing the progress of question 2, as well as the 6th question in the Second Section because of a routing rule referencing the progress of question 4.", + "So only question 3 in Section One, and questions 5 and 7 in Section Two will be displayed.", + "Otherwise, questions 2 and 4 in Section Ona and question 6 in Section Two can also display." + ], + "type": "General", + "answers": [ + { + "id": "s1-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "routing_rules": [ + { + "when": { + "==": [ + { + "source": "answers", + "identifier": "s1-b1-q1-a1" + }, + 0 + ] + }, + "block": "s1-b3" + }, + { + "block": "s1-b2" + } + ] + }, + { + "type": "Question", + "id": "s1-b2", + "question": { + "id": "s1-b2-q1", + "title": "Section 1 Question 2", + "description": ["Showing this question because question 1 value is not 0"], + "type": "General", + "answers": [ + { + "id": "s1-b2-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + }, + { + "type": "Question", + "id": "s1-b3", + "question": { + "id": "s1-b3-q1", + "title": "Section 1 Question 3", + "type": "General", + "answers": [ + { + "id": "s1-b3-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + }, + { + "type": "Question", + "id": "s1-b4", + "question": { + "id": "s1-b4-q1", + "title": "Section 1 Question 4", + "type": "General", + "answers": [ + { + "id": "s1-b4-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [{ "source": "progress", "selector": "block", "identifier": "s1-b2" }, "COMPLETED"] + } + } + } + ], + "id": "group-1" + } + ] + }, + { + "id": "section-2", + "title": "Section Two", + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "s2-b5", + "question": { + "id": "s2-b5-q1", + "title": "Section 2 Question 5", + "type": "General", + "answers": [ + { + "id": "s2-b5-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "routing_rules": [ + { + "when": { + "==": [ + { + "source": "progress", + "selector": "block", + "identifier": "s1-b4" + }, + "COMPLETED" + ] + }, + "block": "s2-b6" + }, + { + "block": "s2-b7" + } + ] + }, + { + "type": "Question", + "id": "s2-b6", + "question": { + "id": "s2-b6-q1", + "title": "Section 2 Question 6", + "description": ["Showing this question because question 4 in Section One was completed"], + "type": "General", + "answers": [ + { + "id": "s2-b6-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + }, + { + "type": "Question", + "id": "s2-b7", + "question": { + "id": "s2-b7-q1", + "title": "Section 2 Question 7", + "type": "General", + "answers": [ + { + "id": "s2-b7-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ], + "id": "group-2" + } + ] + } + ] +} diff --git a/schemas/test/en/test_progress_value_source_calculated_summary.json b/schemas/test/en/test_progress_value_source_calculated_summary.json new file mode 100644 index 0000000000..be36064f2b --- /dev/null +++ b/schemas/test/en/test_progress_value_source_calculated_summary.json @@ -0,0 +1,517 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "survey_id": "139", + "theme": "default", + "title": "Progress Value Source Repeating Sections Test", + "data_version": "0.0.3", + "description": "Progress Value Source Repeating Sections Test", + "navigation": { + "visible": true + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "trad_as", + "type": "string", + "optional": true + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section-1", + "title": "Calculated Summary", + "summary": { "show_on_completion": true }, + "groups": [ + { + "id": "group-1", + "title": "Calculated Summary group", + "blocks": [ + { + "type": "Question", + "id": "first-number-block", + "question": { + "id": "first-number-question", + "title": "First Number Question Title", + "type": "General", + "answers": [ + { + "id": "first-number-answer", + "label": "First answer label", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "second-number-block", + "question": { + "id": "second-number-question", + "title": "Second Number Question Title", + "type": "General", + "answers": [ + { + "id": "second-number-answer", + "label": "Second answer label", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-block", + "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "first-number-answer" + }, + { + "source": "answers", + "identifier": "second-number-answer" + } + ] + }, + "title": "Grand total of previous values" + } + } + ] + } + ] + }, + { + "id": "section-2", + "title": "Skippable random question + List collector", + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "type": "Question", + "id": "s2-b1", + "question": { + "id": "s2-b1-q1", + "title": "Skippable random question", + "type": "General", + "answers": [ + { + "id": "s2-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "block", + "identifier": "calculated-summary-block" + }, + "COMPLETED" + ] + } + } + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "section-3", + "title": "Repeating section", + "summary": { "show_on_completion": true }, + "repeat": { + "for_list": "people", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "groups": [ + { + "id": "dob-group", + "title": "Date of birth", + "blocks": [ + { + "type": "Question", + "id": "dob-block", + "question": { + "answers": [ + { + "id": "date-of-birth-answer", + "mandatory": false, + "maximum": { + "value": "now" + }, + "minimum": { + "offset_by": { + "years": -115 + }, + "value": "2019-10-13" + }, + "type": "Date" + } + ], + "guidance": { + "contents": [ + { + "description": "For example 31 12 1970" + } + ] + }, + "id": "date-of-birth-question", + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "What is {person_name_possessive} date of birth?" + }, + "type": "General" + } + }, + { + "type": "Question", + "id": "other-question-block", + "question": { + "id": "other-question", + "answers": [ + { + "id": "other-answer", + "mandatory": true, + "label": "Anything", + "type": "Number" + } + ], + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "Random question about {person_name_possessive}" + }, + "description": ["Shows because the calculated summary was completed in section 1"], + "type": "General" + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "block", + "identifier": "calculated-summary-block" + }, + "COMPLETED" + ] + } + } + }, + { + "type": "Question", + "id": "other-question-block-2", + "question": { + "id": "other-question-2", + "answers": [ + { + "id": "other-answer-2", + "mandatory": true, + "label": "Anything", + "type": "Number" + } + ], + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "Another random question about {person_name_possessive}" + }, + "description": ["Shows because block 2 of this repeating section was completed."], + "type": "General" + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "block", + "identifier": "other-question-block" + }, + "COMPLETED" + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_progress_value_source_calculated_summary_extended.json b/schemas/test/en/test_progress_value_source_calculated_summary_extended.json new file mode 100644 index 0000000000..caac2ba203 --- /dev/null +++ b/schemas/test/en/test_progress_value_source_calculated_summary_extended.json @@ -0,0 +1,1129 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "survey_id": "139", + "theme": "default", + "title": "Progress Value Source Caluclated Summary (Extended)", + "data_version": "0.0.3", + "description": "An extended version of the Progress Value Source Calculated Summary schema intended to test chained dependency evaluation for progress value sources where multiple sections have progress value source dependencies on one another", + "navigation": { + "visible": true + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "trad_as", + "type": "string", + "optional": true + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { + "required_completed_sections": ["introduction-section"] + } + }, + "sections": [ + { + "id": "introduction-section", + "title": "Guidance", + "show_on_hub": false, + "groups": [ + { + "blocks": [ + { + "id": "interstitial", + "content": { + "title": "Guidance for completing this test schema", + "contents": [ + { + "description": "This schema was created in order to ensure that dependencies based on a progress value sources captured in order." + }, + { + "description": "It is also being used to test progress value sources with chained dependents. For example, In this schema, Sections 7, 8, 9 and 10 are all dependent on Section 2, and Sections 11 and 12 are dependent on Section 9 and 10." + }, + { + "description": "So we can use this schema to test journeys and ensure that all dependent sections are updated. For example if we had not started Section 2 yet, but Sections 8, 9 and 10 are all Complete, and sections 11 and 12 are Partially Completed. Given the dependencies in this schema, completing Section 2 would mean that the status of Sections 8, 9 and 10 would change to Partially Complete and Sections 11 and 12 to Complete." + } + ] + }, + "type": "Interstitial" + } + ], + "id": "introduction-group", + "title": "Test Schema Guidance" + } + ] + }, + { + "id": "section-1", + "title": "Calculated Summary", + "groups": [ + { + "id": "group-1", + "title": "Calculated Summary group", + "blocks": [ + { + "type": "Question", + "id": "first-number-block", + "question": { + "id": "first-number-question", + "title": "First Number Question Title", + "type": "General", + "answers": [ + { + "id": "first-number-answer", + "label": "First answer label", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "second-number-block", + "question": { + "id": "second-number-question", + "title": "Second Number Question Title", + "type": "General", + "answers": [ + { + "id": "second-number-answer", + "label": "Second answer label", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-block", + "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "first-number-answer" + }, + { + "source": "answers", + "identifier": "second-number-answer" + } + ] + }, + "title": "Grand total of previous values" + } + } + ] + } + ] + }, + { + "id": "section-2", + "title": "Skippable random question + List collector", + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "type": "Question", + "id": "s2-b1", + "question": { + "id": "s2-b1-q1", + "title": "Skippable random question", + "type": "General", + "answers": [ + { + "id": "s2-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "block", + "identifier": "calculated-summary-block" + }, + "COMPLETED" + ] + } + } + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "section-3", + "title": "Repeating section", + "summary": { "show_on_completion": true }, + "repeat": { + "for_list": "people", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "groups": [ + { + "id": "dob-group", + "title": "Date of birth", + "blocks": [ + { + "type": "Question", + "id": "dob-block", + "question": { + "answers": [ + { + "id": "date-of-birth-answer", + "mandatory": false, + "maximum": { + "value": "now" + }, + "minimum": { + "offset_by": { + "years": -115 + }, + "value": "2019-10-13" + }, + "type": "Date" + } + ], + "guidance": { + "contents": [ + { + "description": "For example 31 12 1970" + } + ] + }, + "id": "date-of-birth-question", + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "What is {person_name_possessive} date of birth?" + }, + "type": "General" + } + }, + { + "type": "Question", + "id": "other-question-block", + "question": { + "id": "other-question", + "answers": [ + { + "id": "other-answer", + "mandatory": true, + "label": "Anything", + "type": "Number" + } + ], + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "Random question about {person_name_possessive}" + }, + "description": ["Shows because the calculated summary was completed in section 1"], + "type": "General" + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "block", + "identifier": "calculated-summary-block" + }, + "COMPLETED" + ] + } + } + }, + { + "type": "Question", + "id": "other-question-block-2", + "question": { + "id": "other-question-2", + "answers": [ + { + "id": "other-answer-2", + "mandatory": true, + "label": "Anything", + "type": "Number" + } + ], + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "Another random question about {person_name_possessive}" + }, + "description": ["Shows because block 2 of this repeating section was completed."], + "type": "General" + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "block", + "identifier": "other-question-block" + }, + "COMPLETED" + ] + } + } + } + ] + } + ] + }, + { + "id": "section-4", + "title": "Section 4 (Dependent on Section 1)", + "groups": [ + { + "id": "group-4", + "title": "List", + "blocks": [ + { + "type": "Question", + "id": "s4-b1", + "question": { + "id": "s4-b1-q1", + "title": "Skippable random question", + "type": "General", + "answers": [ + { + "id": "s4-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-1" + }, + "COMPLETED" + ] + } + } + }, + { + "type": "Question", + "id": "s4-b2", + "question": { + "id": "s4-b2-q1", + "title": "Random question", + "type": "General", + "answers": [ + { + "id": "s4-b2-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ] + } + ] + }, + { + "id": "section-5", + "title": "Section 5 (Dependent on Calc Summary Block Section 1)", + "groups": [ + { + "id": "group-5", + "title": "List", + "blocks": [ + { + "type": "Question", + "id": "s5-b1", + "question": { + "id": "s5-b1-q1", + "title": "Skippable random question", + "type": "General", + "answers": [ + { + "id": "s5-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "block", + "identifier": "calculated-summary-block" + }, + "COMPLETED" + ] + } + } + }, + { + "type": "Question", + "id": "s5-b2", + "question": { + "id": "s5-b2-q1", + "title": "Random question", + "type": "General", + "answers": [ + { + "id": "s5-b2-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ] + } + ] + }, + { + "id": "section-6", + "title": "Section 6 (Dependent on Section 4)", + "groups": [ + { + "id": "group-6", + "title": "List", + "blocks": [ + { + "type": "Question", + "id": "s6-b1", + "question": { + "id": "s6-b1-q1", + "title": "Skippable random question", + "type": "General", + "answers": [ + { + "id": "s6-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-4" + }, + "COMPLETED" + ] + } + } + }, + { + "type": "Question", + "id": "s6-b2", + "question": { + "id": "s6-b2-q1", + "title": "Random question", + "type": "General", + "answers": [ + { + "id": "s6-b2-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ] + } + ] + }, + { + "id": "section-7", + "title": "Section 7 (Dependent on Section 5)", + "groups": [ + { + "id": "group-7", + "title": "List", + "blocks": [ + { + "type": "Question", + "id": "s7-b1", + "question": { + "id": "s7-b1-q1", + "title": "Skippable random question", + "type": "General", + "answers": [ + { + "id": "s7-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-5" + }, + "COMPLETED" + ] + } + } + }, + { + "type": "Question", + "id": "s7-b2", + "question": { + "id": "s7-b2-q1", + "title": "Skippable random question", + "type": "General", + "answers": [ + { + "id": "s7-b2-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-2" + }, + "COMPLETED" + ] + } + } + }, + { + "type": "Question", + "id": "s7-b3", + "question": { + "id": "s7-b3-q1", + "title": "Random question", + "type": "General", + "answers": [ + { + "id": "s7-b3-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ] + } + ] + }, + { + "id": "section-8", + "title": "Section 8 (Dependent on Section 7 and Section 2)", + "groups": [ + { + "id": "group-8", + "title": "List", + "blocks": [ + { + "type": "Question", + "id": "s8-b1", + "question": { + "id": "s8-b1-q1", + "title": "Skippable random question", + "type": "General", + "answers": [ + { + "id": "s8-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-7" + }, + "COMPLETED" + ] + } + } + }, + { + "type": "Question", + "id": "s8-b2", + "question": { + "id": "s8-b2-q1", + "title": "Skippable random question", + "type": "General", + "answers": [ + { + "id": "s8-b2-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-2" + }, + "COMPLETED" + ] + } + } + }, + { + "type": "Question", + "id": "s8-b3", + "question": { + "id": "s8-b3-q1", + "title": "Random question", + "type": "General", + "answers": [ + { + "id": "s8-b3-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ] + } + ] + }, + { + "id": "section-9", + "title": "Section 9 (Dependent on Section 2)", + "groups": [ + { + "id": "group-9", + "title": "List", + "blocks": [ + { + "type": "Question", + "id": "s9-b1", + "question": { + "id": "s9-b1-q1", + "title": "Skippable random question", + "type": "General", + "answers": [ + { + "id": "s9-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-2" + }, + "COMPLETED" + ] + } + } + }, + { + "type": "Question", + "id": "s9-b2", + "question": { + "id": "s9-b2-q1", + "title": "Random question", + "type": "General", + "answers": [ + { + "id": "s9-b2-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ] + } + ] + }, + { + "id": "section-10", + "title": "Section 10 (Dependent on Section 2)", + "groups": [ + { + "id": "group-10", + "title": "List", + "blocks": [ + { + "type": "Question", + "id": "s10-b1", + "question": { + "id": "s10-b1-q1", + "title": "Skippable random question", + "type": "General", + "answers": [ + { + "id": "s10-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-2" + }, + "COMPLETED" + ] + } + } + }, + { + "type": "Question", + "id": "s10-b2", + "question": { + "id": "s10-b2-q1", + "title": "Random question", + "type": "General", + "answers": [ + { + "id": "s10-b2-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ] + } + ] + }, + { + "id": "section-11", + "title": "Section 11 (Dependent on Section 10)", + "groups": [ + { + "id": "group-11", + "title": "List", + "blocks": [ + { + "type": "Question", + "id": "s11-b1", + "question": { + "id": "s11-b1-q1", + "title": "Skippable random question", + "type": "General", + "answers": [ + { + "id": "s11-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-10" + }, + "COMPLETED" + ] + } + } + }, + { + "type": "Question", + "id": "s11-b2", + "question": { + "id": "s11-b2-q1", + "title": "Random question", + "type": "General", + "answers": [ + { + "id": "s11-b2-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ] + } + ] + }, + { + "id": "section-12", + "title": "Section 12 (Dependent on Section 9)", + "groups": [ + { + "id": "group-12", + "title": "List", + "blocks": [ + { + "type": "Question", + "id": "s12-b1", + "question": { + "id": "s12-b1-q1", + "title": "Skippable random question", + "type": "General", + "answers": [ + { + "id": "s12-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-9" + }, + "COMPLETED" + ] + } + } + }, + { + "type": "Question", + "id": "s12-b2", + "question": { + "id": "s12-b2-q1", + "title": "Random question", + "type": "General", + "answers": [ + { + "id": "s12-b2-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_progress_value_source_repeating_sections_chained_dependencies.json b/schemas/test/en/test_progress_value_source_repeating_sections_chained_dependencies.json new file mode 100644 index 0000000000..390821f170 --- /dev/null +++ b/schemas/test/en/test_progress_value_source_repeating_sections_chained_dependencies.json @@ -0,0 +1,490 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "survey_id": "139", + "theme": "default", + "title": "Progress Value Source Repeating Sections With Chained Dependencies Test", + "data_version": "0.0.3", + "description": "Progress Value Source Repeating Sections Test", + "navigation": { + "visible": true + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "trad_as", + "type": "string", + "optional": true + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section-1", + "title": "Section 1", + "groups": [ + { + "id": "group-1", + "title": "List", + "blocks": [ + { + "type": "Question", + "id": "s1-b2", + "question": { + "id": "s1-b1-q1", + "title": "Random question", + "type": "General", + "answers": [ + { + "id": "s1-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ] + } + ] + }, + { + "id": "section-2", + "title": "Section 2 (Dependent on Section 1)", + "groups": [ + { + "id": "group-2", + "title": "List", + "blocks": [ + { + "type": "Question", + "id": "s2-b1", + "question": { + "id": "s2-b1-q1", + "title": "Skippable random question", + "type": "General", + "answers": [ + { + "id": "s2-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-1" + }, + "COMPLETED" + ] + } + } + }, + { + "type": "Question", + "id": "s2-b2", + "question": { + "id": "s2-b2-q1", + "title": "Random question", + "type": "General", + "answers": [ + { + "id": "s2-b2-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ] + } + ] + }, + { + "id": "section-3", + "title": "Section 3 (Depends on Section 2)", + "groups": [ + { + "id": "group", + "title": "Second List Collector", + "blocks": [ + { + "id": "second-list-collector", + "type": "ListCollector", + "for_list": "second-people", + "question": { + "id": "second-confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "second-anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "second-add-person", + "type": "ListAddQuestion", + "question": { + "id": "second-add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "second-first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "second-last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "second-edit-person", + "type": "ListEditQuestion", + "question": { + "id": "second-edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "second-first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "second-last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "second-remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "second-remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "second-remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "second-first-name" + }, + { + "source": "answers", + "identifier": "second-last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "type": "Question", + "id": "second-question-block", + "question": { + "id": "second-question", + "title": "Question", + "type": "General", + "answers": [ + { + "id": "second-answer", + "mandatory": false, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-2" + }, + "COMPLETED" + ] + } + } + }, + { + "type": "Question", + "id": "second-random-question-enabler-block", + "question": { + "id": "second-random-question-enabler-question", + "title": "Random question enabler", + "description": [ + "Answering this question will enable the random question in the repeated section coming after the list collector." + ], + "type": "General", + "answers": [ + { + "id": "second-random-question-enabler-answer", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ] + } + ] + }, + { + "id": "section-4", + "title": "Section 4 - Repeat (Depends on section 3)", + "summary": { "show_on_completion": true }, + "repeat": { + "for_list": "second-people", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "second-first-name" + }, + { + "source": "answers", + "identifier": "second-last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "groups": [ + { + "id": "second-dob-group", + "title": "Date of birth", + "blocks": [ + { + "type": "Question", + "id": "second-dob-block", + "question": { + "answers": [ + { + "id": "second-date-of-birth-answer", + "mandatory": false, + "maximum": { + "value": "now" + }, + "minimum": { + "offset_by": { + "years": -115 + }, + "value": "2019-10-13" + }, + "type": "Date" + } + ], + "guidance": { + "contents": [ + { + "description": "For example 31 12 1970" + } + ] + }, + "id": "second-date-of-birth-question", + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "second-first-name" + }, + { + "source": "answers", + "identifier": "second-last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "What is {person_name_possessive} date of birth?" + }, + "type": "General" + } + }, + { + "type": "Question", + "id": "second-other-question-block", + "question": { + "id": "second-other-question", + "answers": [ + { + "id": "second-other-answer", + "mandatory": true, + "label": "Anything", + "type": "Number" + } + ], + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "second-first-name" + }, + { + "source": "answers", + "identifier": "second-last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "Random question about {person_name_possessive}" + }, + "description": ["Shows because section 2 was completed"], + "type": "General" + }, + "skip_conditions": { + "when": { + "!=": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-2" + }, + "COMPLETED" + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_progress_value_source_section_enabled_hub.json b/schemas/test/en/test_progress_value_source_section_enabled_hub.json new file mode 100644 index 0000000000..e3babd5cb2 --- /dev/null +++ b/schemas/test/en/test_progress_value_source_section_enabled_hub.json @@ -0,0 +1,110 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test progress value source", + "theme": "default", + "description": "A test survey for testing progress value source section enabled in a hub flow", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section-1", + "title": "Section 1", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "s1-b1", + "question": { + "id": "s1-b1-q1", + "title": "Section 1 Question 1", + "description": ["Always shows"], + "type": "General", + "answers": [ + { + "id": "s1-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + }, + { + "type": "Question", + "id": "s1-b2", + "question": { + "id": "s1-b2-q1", + "title": "Section 1 Question 2", + "type": "General", + "answers": [ + { + "id": "s1-b2-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ], + "id": "group-1" + } + ] + }, + { + "id": "section-2", + "title": "Section 2", + "enabled": { + "when": { + "==": [{ "source": "progress", "selector": "section", "identifier": "section-1" }, "COMPLETED"] + } + }, + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "s2-b1", + "question": { + "id": "s2-b1-q1", + "title": "Section 2 Question 1", + "description": ["This question always shows"], + "type": "General", + "answers": [ + { + "id": "s2-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ], + "id": "group-2" + } + ] + } + ] +} diff --git a/schemas/test/en/test_progress_value_source_section_enabled_hub_complex.json b/schemas/test/en/test_progress_value_source_section_enabled_hub_complex.json new file mode 100644 index 0000000000..4d647dbdb6 --- /dev/null +++ b/schemas/test/en/test_progress_value_source_section_enabled_hub_complex.json @@ -0,0 +1,251 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test progress value source", + "theme": "default", + "description": "A test survey for testing progress value source section enabled in a hub flow, with a mixture of skip conditions and section enabled conditions, and a mix of block and section references", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section-1", + "title": "Section 1", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "s1-b1", + "question": { + "id": "s1-b1-q1", + "title": "Section 1 Question 1", + "description": ["Always shows. The next question in the section also shows when the answer is not 0"], + "type": "General", + "answers": [ + { + "id": "s1-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "routing_rules": [ + { + "when": { + "!=": [ + { + "identifier": "s1-b1-q1-a1", + "source": "answers" + }, + 0 + ] + }, + "block": "s1-b2" + }, + { + "section": "End" + } + ] + }, + { + "type": "Question", + "id": "s1-b2", + "question": { + "id": "s1-b2-q1", + "title": "Section 1 Question 2", + "type": "General", + "description": ["Shows if the answer to the previous question is not 0"], + "answers": [ + { + "id": "s1-b2-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ], + "id": "group-1" + } + ] + }, + { + "id": "section-2", + "title": "Section 2", + "enabled": { + "when": { + "==": [{ "source": "progress", "selector": "section", "identifier": "section-1" }, "COMPLETED"] + } + }, + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "s2-b1", + "question": { + "id": "s2-b1-q1", + "title": "Section 2 Question 1", + "description": ["This question always shows. The next question in the section also shows when the answer is not 0"], + "type": "General", + "answers": [ + { + "id": "s2-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + }, + { + "type": "Question", + "id": "s2-b2", + "question": { + "id": "s2-b2-q1", + "title": "Section 2 Question 2", + "type": "General", + "description": ["Always shows"], + "answers": [ + { + "id": "s2-b2-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + }, + "routing_rules": [ + { + "when": { + "!=": [ + { + "identifier": "s2-b1-q1-a1", + "source": "answers" + }, + 0 + ] + }, + "block": "s2-b3" + }, + { + "section": "End" + } + ] + }, + { + "type": "Question", + "id": "s2-b3", + "question": { + "id": "s2-b3-q1", + "title": "Section 2 Question 3", + "type": "General", + "description": ["Shows if the answer to the Section 2 Question 1 is not 0"], + "answers": [ + { + "id": "s2-b3-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ], + "id": "group-2" + } + ] + }, + { + "id": "section-3", + "title": "Section 3", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "s3-b1", + "question": { + "id": "s3-b1-q1", + "title": "Section 3 Question 1", + "description": ["Always shows"], + "type": "General", + "answers": [ + { + "id": "s3-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ], + "id": "group-3" + } + ] + }, + { + "id": "section-4", + "title": "Section 4", + "enabled": { + "when": { + "and": [ + { + "==": [{ "source": "progress", "selector": "block", "identifier": "s2-b2" }, "COMPLETED"] + }, + { + "==": [{ "source": "progress", "selector": "section", "identifier": "section-2" }, "COMPLETED"] + } + ] + } + }, + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "s4-b1", + "question": { + "id": "s4-b1-q1", + "title": "Section 4 Question 1", + "description": ["This section shows if section 2 block 2 is completed, as well as section 2"], + "type": "General", + "answers": [ + { + "id": "s4-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ], + "id": "group-4" + } + ] + } + ] +} diff --git a/schemas/test/en/test_progress_value_source_section_enabled_no_hub.json b/schemas/test/en/test_progress_value_source_section_enabled_no_hub.json new file mode 100644 index 0000000000..a9f88839d2 --- /dev/null +++ b/schemas/test/en/test_progress_value_source_section_enabled_no_hub.json @@ -0,0 +1,114 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test progress value source", + "theme": "default", + "description": "A test survey for testing progress value source section enabled in a linear flow", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section-1", + "title": "Section 1", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "s1-b1", + "question": { + "id": "s1-b1-q1", + "title": "Section 1 Question 1", + "description": ["Always shows"], + "type": "General", + "answers": [ + { + "id": "s1-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + }, + { + "type": "Question", + "id": "s1-b2", + "question": { + "id": "s1-b2-q1", + "title": "Section 1 Question 2", + "type": "General", + "answers": [ + { + "id": "s1-b2-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ], + "id": "group-1" + } + ] + }, + { + "id": "section-2", + "title": "Section 2", + "enabled": { + "when": { + "==": [{ "source": "progress", "selector": "section", "identifier": "section-1" }, "COMPLETED"] + } + }, + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "s2-b1", + "question": { + "id": "s2-b1-q1", + "title": "Section 2 Question 1", + "description": ["This question always shows"], + "type": "General", + "answers": [ + { + "id": "s2-b1-q1-a1", + "mandatory": true, + "label": "Enter any number", + "type": "Number" + } + ] + } + } + ], + "id": "group-2" + } + ] + } + ] +} diff --git a/schemas/test/en/test_question_definition.json b/schemas/test/en/test_question_definition.json new file mode 100644 index 0000000000..9233ebff3d --- /dev/null +++ b/schemas/test/en/test_question_definition.json @@ -0,0 +1,78 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Other input fields", + "theme": "default", + "description": "A questionnaire to test definitions.", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "definition-group", + "blocks": [ + { + "type": "Question", + "id": "definition-block", + "question": { + "id": "question", + "title": "Do you connect a LiFePO4 battery to your photovoltaic system to store surplus energy?", + "type": "General", + "definition": { + "title": "What is a photovoltaic system?", + "contents": [ + { + "description": "A typical photovoltaic system employs solar panels, each comprising a number of solar cells, which generate electrical power. PV installations may be ground-mounted, rooftop mounted or wall mounted. The mount may be fixed, or use a solar tracker to follow the sun across the sky." + } + ] + }, + "answers": [ + { + "type": "Radio", + "id": "radio-mandatory-answer", + "mandatory": false, + "options": [ + { + "label": "Yes, I do connect a battery", + "value": "Yes, I do connect a battery" + }, + { + "label": "No, I don’t connect a battery", + "value": "No, I don’t connect a battery" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_question_definition_array_type.json b/schemas/test/en/test_question_definition_array_type.json new file mode 100644 index 0000000000..f691d55993 --- /dev/null +++ b/schemas/test/en/test_question_definition_array_type.json @@ -0,0 +1,80 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Other input fields", + "theme": "default", + "description": "A questionnaire to test definitions (array type).", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "definition-group", + "blocks": [ + { + "type": "Question", + "id": "definition-block", + "question": { + "id": "question", + "title": "Do you connect a LiFePO4 battery to your photovoltaic system to store surplus energy?", + "type": "General", + "definitions": [ + { + "title": "What is a photovoltaic system?", + "contents": [ + { + "description": "A typical photovoltaic system employs solar panels, each comprising a number of solar cells, which generate electrical power. PV installations may be ground-mounted, rooftop mounted or wall mounted. The mount may be fixed, or use a solar tracker to follow the sun across the sky." + } + ] + } + ], + "answers": [ + { + "type": "Radio", + "id": "radio-mandatory-answer", + "mandatory": false, + "options": [ + { + "label": "Yes, I do connect a battery", + "value": "Yes, I do connect a battery" + }, + { + "label": "No, I don’t connect a battery", + "value": "No, I don’t connect a battery" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_question_description.json b/schemas/test/en/test_question_description.json new file mode 100644 index 0000000000..4904ec7083 --- /dev/null +++ b/schemas/test/en/test_question_description.json @@ -0,0 +1,69 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Other input fields", + "theme": "default", + "description": "A questionnaire to demo checkbox field Other input.", + "messages": { + "NUMBER_TOO_LARGE": "Number is too large", + "NUMBER_TOO_SMALL": "Number cannot be less than zero", + "INVALID_NUMBER": "Please enter an integer" + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "name-block", + "question": { + "description": ["Answer the question", "Go on"], + "answers": [ + { + "id": "name-answer", + "label": "What is your name?", + "max_length": 20, + "mandatory": false, + "type": "TextField" + } + ], + "id": "name-question", + "title": "Title", + "type": "General" + } + } + ], + "id": "checkboxes", + "title": "Title" + } + ] + } + ] +} diff --git a/schemas/test/en/test_question_guidance.json b/schemas/test/en/test_question_guidance.json new file mode 100644 index 0000000000..5cc4695019 --- /dev/null +++ b/schemas/test/en/test_question_guidance.json @@ -0,0 +1,310 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Question Guidance Test", + "theme": "default", + "description": "A questionnaire to test question guidance content", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "group", + "blocks": [ + { + "type": "Introduction", + "id": "introduction" + }, + { + "type": "Question", + "id": "block-test-guidance-title", + "question": { + "id": "question-test-guidance-title", + "title": "Question: Test guidance title", + "description": ["Testing combinations of the title within guidance"], + "guidance": { + "contents": [ + { + "title": "This one has a description but no list" + }, + { + "description": "No list items below this text" + }, + { + "title": "This one has no list or description" + }, + { + "description": "title, description, title, description" + } + ] + }, + "type": "General", + "answers": [ + { + "id": "answer-test-guidance-title", + "label": "Text question", + "mandatory": false, + "type": "TextField" + } + ] + } + }, + { + "type": "Question", + "id": "block-test-guidance-description", + "question": { + "id": "question-test-guidance-description", + "title": "Question: Test guidance descriptions", + "description": ["Tests the descriptions within guidance"], + "guidance": { + "contents": [ + { + "description": "No title above this text, list below" + }, + { + "list": ["Item Include 1", "Item Include 2", "Item Include 3", "Item Include 4"] + }, + { + "description": "Just description, no title above this text, no list below" + } + ] + }, + "type": "General", + "answers": [ + { + "id": "answer-test-guidance-description", + "label": "Text question", + "mandatory": false, + "type": "TextField" + } + ] + } + }, + { + "type": "Question", + "id": "block-test-guidance-lists", + "question": { + "id": "question-test-guidance-lists", + "title": "Question: Test guidance lists (with no question description below)", + "guidance": { + "contents": [ + { + "title": "Title, no description, list follows", + "list": ["Item Include 1", "Item Include 2", "Item Include 3", "Item Include 4"] + }, + { + "list": [ + "List with no title or description 1", + "List with no title or description 2", + "List with no title or description 3", + "List with no title or description 4" + ] + } + ] + }, + "type": "General", + "answers": [ + { + "id": "answer-test-guidance-lists", + "label": "Text question", + "mandatory": false, + "type": "TextField" + } + ] + } + }, + { + "type": "Question", + "id": "block-test-guidance-content-description", + "question": { + "id": "question-test-guidance-content-description", + "title": "Question: Test show guidance content description", + "guidance": { + "contents": [ + { + "description": "Guidance with content description" + } + ] + }, + "type": "General", + "answers": [ + { + "guidance": { + "show_guidance": "Show test guidance.", + "hide_guidance": "Hide test guidance.", + "contents": [ + { + "description": "The text here is for description" + } + ] + }, + "id": "answer-test-guidance-content-description", + "label": "Text question", + "mandatory": false, + "type": "TextField" + } + ] + } + }, + { + "type": "Question", + "id": "block-test-guidance-content-title", + "question": { + "id": "question-test-guidance-content-title", + "title": "Question: Test show guidance content title", + "guidance": { + "contents": [ + { + "description": "Guidance with content title" + } + ] + }, + "type": "General", + "answers": [ + { + "guidance": { + "show_guidance": "Show test guidance.", + "hide_guidance": "Hide test guidance.", + "contents": [ + { + "title": "The text here is for a title" + } + ] + }, + "id": "answer-test-guidance-content-title", + "label": "Text question", + "mandatory": false, + "type": "TextField" + } + ] + } + }, + { + "type": "Question", + "id": "block-test-guidance-content-list", + "question": { + "id": "question-test-guidance-content-list", + "title": "Question: Test show guidance content list", + "guidance": { + "contents": [ + { + "title": "Guidance with content list" + } + ] + }, + "type": "General", + "answers": [ + { + "guidance": { + "show_guidance": "Show test guidance.", + "hide_guidance": "Hide test guidance.", + "contents": [ + { + "list": ["The text here is for a list", "Another list item", "One more"] + } + ] + }, + "id": "answer-test-guidance-content-list", + "label": "Text question", + "mandatory": false, + "type": "TextField" + } + ] + } + }, + { + "type": "Question", + "id": "block-test-guidance-all", + "question": { + "id": "question-test-guidance-all", + "title": "Question: Test guidance all", + "description": ["Testing all features of the guidance block enabled together"], + "guidance": { + "contents": [ + { + "title": "Include" + }, + { + "description": "

Guidance include description text

" + }, + { + "list": ["Item Include 1", "Item Include 2", "Item Include 3", "Item Include 4"] + }, + { + "title": "Exclude" + }, + { + "description": "

Guidance exclude description text

" + }, + { + "list": ["Item Exclude 1", "Item Exclude 2", "Item Exclude 3", "Item Exclude 4"] + }, + { + "title": "Other" + }, + { + "description": "

Guidance other description text

" + }, + { + "list": ["Item Other 1", "Item Other 2", "Item Other 3", "Item Other 4"] + } + ] + }, + "type": "General", + "answers": [ + { + "guidance": { + "show_guidance": "Show test guidance.", + "hide_guidance": "Hide test guidance.", + "contents": [ + { + "description": "The text here is for a description" + }, + { + "description": "Here’s some more description text" + }, + { + "title": "This text here is the title for the list", + "list": ["The text here is for a list", "Another list item", "One more"] + } + ] + }, + "id": "answer-test-guidance-all", + "label": "Text question", + "mandatory": false, + "type": "TextField" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_question_title_in_error.json b/schemas/test/en/test_question_title_in_error.json new file mode 100644 index 0000000000..9a4d97b934 --- /dev/null +++ b/schemas/test/en/test_question_title_in_error.json @@ -0,0 +1,160 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Question Validation Test", + "theme": "default", + "description": "A questionnaire to test use of the question title in validation", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "mutually-exclusive-checkbox-section", + "groups": [ + { + "id": "mutually-exclusive-mandatory-group", + "title": "Mutually Exclusive Group", + "blocks": [ + { + "type": "Question", + "id": "mandatory-checkbox", + "question": { + "answers": [ + { + "id": "mandatory-checkbox-answer", + "mandatory": true, + "options": [ + { + "label": "Cheese", + "value": "Cheese" + }, + { + "label": "Ham", + "value": "Ham" + }, + { + "label": "Pineapple", + "value": "Pineapple" + }, + { + "label": "Tuna", + "value": "Tuna" + }, + { + "label": "Pepperoni", + "value": "Pepperoni" + }, + { + "label": "Other", + "description": "Choose any other topping", + "value": "Other", + "detail_answer": { + "mandatory": true, + "id": "other-answer-mandatory", + "label": "Please specify other", + "type": "TextField" + } + } + ], + "type": "Checkbox" + } + ], + "id": "mandatory-checkbox-question", + "title": "Which pizza toppings would you like?", + "type": "General" + } + }, + { + "type": "Question", + "id": "mutually-exclusive-checkbox", + "question": { + "id": "mutually-exclusive-checkbox-question", + "type": "MutuallyExclusive", + "title": { + "text": "Did you really answer ‘{topping_answers}’ to the previous question?", + "placeholders": [ + { + "placeholder": "topping_answers", + "transforms": [ + { + "arguments": { + "delimiter": ", ", + "list_to_concatenate": [ + { + "identifier": "mandatory-checkbox-answer", + "source": "answers" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + }, + "mandatory": true, + "answers": [ + { + "id": "checkbox-answer", + "instruction": "Select answer", + "type": "Checkbox", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + }, + { + "id": "checkbox-exclusive-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "I prefer not to say", + "description": "Some description", + "value": "I prefer not to say" + } + ] + } + ], + "validation": { + "messages": { + "MANDATORY_QUESTION": "Select an answer to ‘%(question_title)s’ to continue" + } + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_radio_checkbox_descriptions.json b/schemas/test/en/test_radio_checkbox_descriptions.json new file mode 100644 index 0000000000..9e7011aad6 --- /dev/null +++ b/schemas/test/en/test_radio_checkbox_descriptions.json @@ -0,0 +1,126 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Survey - Checkbox and Radio option descriptions", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "radio-checkbox-descriptio", + "title": "Did this business make major changes in the following areas?", + "blocks": [ + { + "type": "Question", + "id": "checkbox-block", + "question": { + "answers": [ + { + "id": "checkbox-answer", + "label": "Did this business make major changes in the following areas?", + "mandatory": true, + "options": [ + { + "label": "New business practices for organising procedures", + "value": "New business practices for organising procedures", + "description": "For example supply chain management, business re-engineering, knowledge management, lean production, quality management" + }, + { + "label": "New methods of organising work responsibilities and decision making", + "value": "New methods of organising work responsibilities and decision making", + "description": "For example first use of a new system of employee responsibilities, team work, decentralisation, integration or de-integration of departments, education / training systems" + }, + { + "label": "New methods of organising external relationships with other firms or public institutions", + "value": "New methods of organising external relationships with other firms or public institutions", + "description": "For example first use of alliances, partnerships, outsourcing or sub-contracting" + }, + { + "label": "Implementation of changes to marketing concepts or strategies", + "value": "Implementation of changes to marketing concepts or strategies" + } + ], + "type": "Checkbox", + "validation": { + "messages": {} + } + } + ], + "id": "checkbox-question", + "title": "Did this business make major changes in the following areas?", + "type": "General" + } + }, + { + "type": "Question", + "id": "radio-block", + "question": { + "answers": [ + { + "id": "radio-answer", + "label": "Did this business make major changes in the following areas?", + "mandatory": true, + "options": [ + { + "label": "New business practices for organising procedures", + "value": "New business practices for organising procedures", + "description": "For example supply chain management, business re-engineering, knowledge management, lean production, quality management" + }, + { + "label": "New methods of organising work responsibilities and decision making", + "value": "New methods of organising work responsibilities and decision making", + "description": "For example first use of a new system of employee responsibilities, team work, decentralisation, integration or de-integration of departments, education / training systems" + }, + { + "label": "New methods of organising external relationships with other firms or public institutions", + "value": "New methods of organising external relationships with other firms or public institutions", + "description": "For example first use of alliances, partnerships, outsourcing or sub-contracting" + }, + { + "label": "Implementation of changes to marketing concepts or strategies", + "value": "Implementation of changes to marketing concepts or strategies" + } + ], + "type": "Radio", + "validation": { + "messages": {} + } + } + ], + "id": "radio-question", + "title": "Did this business make major changes in the following areas?", + "type": "General" + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_radio_detail_answer_dropdown.json b/schemas/test/en/test_radio_detail_answer_dropdown.json new file mode 100644 index 0000000000..3e576dac95 --- /dev/null +++ b/schemas/test/en/test_radio_detail_answer_dropdown.json @@ -0,0 +1,128 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Radio with Dropdown Detail Answer", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "radio", + "title": "Dropdown Radio with detail answer", + "blocks": [ + { + "type": "Question", + "id": "optional-radio-with-dropdown-detail-answer-block", + "question": { + "type": "General", + "id": "optional-radio-with-dropdown-detail-answer-question", + "title": "What is your favourite Ice Cream topping?", + "guidance": { + "contents": [ + { + "list": ["Fruit detail answer is optional", "Jam detail answer is mandatory"] + } + ] + }, + "answers": [ + { + "type": "Radio", + "id": "optional-radio-with-dropdown-detail-answer", + "label": "Select your favourite toppings", + "mandatory": false, + "options": [ + { + "label": "Sprinkles", + "value": "Sprinkles" + }, + { + "label": "Fruit", + "value": "Fruit", + "detail_answer": { + "type": "Dropdown", + "id": "optional-radio-with-optional-dropdown-detail-answer", + "mandatory": false, + "label": "Please specify type", + "placeholder": "Select fruit", + "options": [ + { + "label": "Mango", + "value": "Mango" + }, + { + "label": "Pineapple", + "value": "Pineapple" + }, + { + "label": "Peach", + "value": "Peach" + } + ] + } + }, + { + "label": "Jam", + "value": "Jam", + "detail_answer": { + "type": "Dropdown", + "id": "optional-radio-with-mandatory-dropdown-detail-answer", + "mandatory": true, + "label": "Please specify type", + "validation": { + "messages": { + "MANDATORY_DROPDOWN": "Please select the type of Jam" + } + }, + "options": [ + { + "label": "Strawberry", + "value": "Strawberry" + }, + { + "label": "Raspberry", + "value": "Raspberry" + }, + { + "label": "Apricot", + "value": "Apricot" + } + ] + } + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_radio_detail_answer_multiple.json b/schemas/test/en/test_radio_detail_answer_multiple.json new file mode 100644 index 0000000000..69d848c21f --- /dev/null +++ b/schemas/test/en/test_radio_detail_answer_multiple.json @@ -0,0 +1,92 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Radio Mandatory with Mandatory Detail Answer Overridden Error", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "radio", + "title": "Radio Mandatory with Mandatory Detail Answer Overridden Error", + "blocks": [ + { + "type": "Question", + "id": "radio-mandatory", + "question": { + "type": "General", + "id": "radio-mandatory-question", + "title": "What is you favourite breakfast item?", + "answers": [ + { + "type": "Radio", + "id": "radio-mandatory-answer", + "mandatory": true, + "options": [ + { + "label": "Toast", + "value": "Toast" + }, + { + "label": "Eggs", + "value": "Eggs", + "detail_answer": { + "mandatory": false, + "id": "eggs-answer", + "label": "Please write your favourite egg type", + "type": "TextField" + } + }, + { + "label": "Favourite not listed", + "description": "An answer is required.", + "value": "Favourite not listed", + "detail_answer": { + "mandatory": true, + "id": "alternate-answer", + "label": "Please write your favourite", + "type": "TextField", + "validation": { + "messages": { + "MANDATORY_TEXTFIELD": "Enter your favourite to continue" + } + } + } + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_radio_detail_answer_numeric.json b/schemas/test/en/test_radio_detail_answer_numeric.json new file mode 100644 index 0000000000..c2613bc86f --- /dev/null +++ b/schemas/test/en/test_radio_detail_answer_numeric.json @@ -0,0 +1,95 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Numeric Radio with other", + "theme": "default", + "messages": { + "NUMBER_TOO_LARGE": "Number is too large", + "NUMBER_TOO_SMALL": "Number cannot be less than zero", + "INVALID_NUMBER": "Please enter an integer" + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "radio", + "title": "Numeric Radio with detail answer", + "blocks": [ + { + "type": "Question", + "id": "radio-numeric-detail", + "question": { + "type": "General", + "id": "radio-question-numeric-detail", + "title": "How many items would you like on your breakfast?", + "answers": [ + { + "type": "Radio", + "validation": { + "messages": {} + }, + "id": "radio-answer-numeric-detail", + "mandatory": false, + "options": [ + { + "label": "1", + "value": "1" + }, + { + "label": "2", + "value": "2" + }, + { + "label": "None", + "value": "None" + }, + { + "label": "Other", + "value": "Other", + "detail_answer": { + "mandatory": false, + "id": "other-answer", + "label": "Please enter a number of items", + "type": "Number", + "maximum": { + "value": 20 + } + } + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_radio_detail_answer_visible.json b/schemas/test/en/test_radio_detail_answer_visible.json new file mode 100644 index 0000000000..1abcffcdd5 --- /dev/null +++ b/schemas/test/en/test_radio_detail_answer_visible.json @@ -0,0 +1,147 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Radio Visible", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section-1", + "groups": [ + { + "id": "radio", + "title": "Radio Open", + "blocks": [ + { + "type": "Question", + "id": "radio-visible-true", + "question": { + "type": "General", + "id": "radio-visible-true-question", + "title": "What is your favourite drink?", + "answers": [ + { + "type": "Radio", + "id": "radio-visible-true-answer", + "mandatory": false, + "voluntary": true, + "options": [ + { + "label": "Coffee", + "value": "Coffee" + }, + { + "detail_answer": { + "id": "radio-visible-true-answer-other", + "label": "Enter your favourite drink", + "mandatory": false, + "visible": true, + "type": "TextField" + }, + "label": "Other", + "value": "Other" + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "radio-visible-false", + "question": { + "type": "General", + "id": "radio-visible-false-question", + "title": "What is your favourite food?", + "answers": [ + { + "type": "Radio", + "id": "radio-visible-false-answer", + "mandatory": false, + "voluntary": false, + "options": [ + { + "label": "Ice cream", + "value": "Ice cream" + }, + { + "description": "Select to enter answer", + "detail_answer": { + "id": "radio-visible-false-answer-other", + "label": "Enter your favourite food", + "mandatory": false, + "visible": false, + "type": "TextField" + }, + "label": "Other", + "value": "Other" + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "radio-visible-none", + "question": { + "type": "General", + "id": "radio-visible-none-question", + "title": "What is your favourite colour?", + "answers": [ + { + "type": "Radio", + "id": "radio-visible-none-answer", + "mandatory": false, + "voluntary": false, + "options": [ + { + "label": "Blue", + "value": "Blue" + }, + { + "description": "Select to enter answer", + "detail_answer": { + "id": "radio-visible-none-answer-other", + "label": "Enter your favourite colour", + "mandatory": false, + "type": "TextField" + }, + "label": "Other", + "value": "Other" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_radio_mandatory.json b/schemas/test/en/test_radio_mandatory.json new file mode 100644 index 0000000000..1af1f48d03 --- /dev/null +++ b/schemas/test/en/test_radio_mandatory.json @@ -0,0 +1,74 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Radio Mandatory", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "radio", + "title": "Radio Mandatory", + "blocks": [ + { + "type": "Question", + "id": "radio-mandatory", + "question": { + "type": "General", + "id": "radio-mandatory-question", + "title": "What do you prefer for breakfast?", + "answers": [ + { + "type": "Radio", + "id": "radio-mandatory-answer", + "mandatory": true, + "options": [ + { + "label": "Coffee", + "value": "Coffee" + }, + { + "label": "Tea", + "value": "Tea" + }, + { + "label": "Tea & Coffee", + "value": "Tea & Coffee" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_radio_mandatory_with_detail_answer_mandatory.json b/schemas/test/en/test_radio_mandatory_with_detail_answer_mandatory.json new file mode 100644 index 0000000000..4b2aa6e797 --- /dev/null +++ b/schemas/test/en/test_radio_mandatory_with_detail_answer_mandatory.json @@ -0,0 +1,77 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Radio Mandatory with Mandatory Detail Answer", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "radio", + "title": "Radio Mandatory with Detail Answer", + "blocks": [ + { + "type": "Question", + "id": "radio-mandatory", + "question": { + "type": "General", + "id": "radio-mandatory-question", + "title": "What is you favourite breakfast item?", + "answers": [ + { + "type": "Radio", + "id": "radio-mandatory-answer", + "mandatory": true, + "options": [ + { + "label": "Toast", + "value": "Toast" + }, + { + "label": "Other", + "description": "An answer is required.", + "value": "Other", + "detail_answer": { + "mandatory": true, + "id": "other-answer-mandatory", + "label": "Please specify other", + "type": "TextField" + } + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_radio_mandatory_with_detail_answer_mandatory_with_overridden_error.json b/schemas/test/en/test_radio_mandatory_with_detail_answer_mandatory_with_overridden_error.json new file mode 100644 index 0000000000..8bc0c6329f --- /dev/null +++ b/schemas/test/en/test_radio_mandatory_with_detail_answer_mandatory_with_overridden_error.json @@ -0,0 +1,82 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Radio Mandatory with Mandatory Detail Answer Overridden Error", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "radio", + "title": "Radio Mandatory with Mandatory Detail Answer Overridden Error", + "blocks": [ + { + "type": "Question", + "id": "radio-mandatory", + "question": { + "type": "General", + "id": "radio-mandatory-question", + "title": "What is you favourite breakfast item?", + "answers": [ + { + "type": "Radio", + "id": "radio-mandatory-answer", + "mandatory": true, + "options": [ + { + "label": "Toast", + "value": "Toast" + }, + { + "label": "Other", + "description": "An answer is required.", + "value": "Other", + "detail_answer": { + "mandatory": true, + "id": "other-answer-mandatory", + "label": "Please specify other", + "type": "TextField", + "validation": { + "messages": { + "MANDATORY_TEXTFIELD": "Test error message is overridden" + } + } + } + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_radio_mandatory_with_detail_answer_optional.json b/schemas/test/en/test_radio_mandatory_with_detail_answer_optional.json new file mode 100644 index 0000000000..02a190b478 --- /dev/null +++ b/schemas/test/en/test_radio_mandatory_with_detail_answer_optional.json @@ -0,0 +1,77 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Radio Mandatory with Optional Detail Answer", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "radio", + "title": "Radio Mandatory with Optional Detail Answer", + "blocks": [ + { + "type": "Question", + "id": "radio-mandatory", + "question": { + "type": "General", + "id": "radio-mandatory-question", + "title": "What is you favourite breakfast item?", + "answers": [ + { + "type": "Radio", + "id": "radio-mandatory-answer", + "mandatory": false, + "options": [ + { + "label": "Toast", + "value": "Toast" + }, + { + "label": "Other", + "description": "An answer is required.", + "value": "Other", + "detail_answer": { + "mandatory": false, + "id": "other-answer-mandatory", + "label": "Please specify other", + "type": "TextField" + } + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_radio_mandatory_with_overridden_error.json b/schemas/test/en/test_radio_mandatory_with_overridden_error.json new file mode 100644 index 0000000000..739d64fc97 --- /dev/null +++ b/schemas/test/en/test_radio_mandatory_with_overridden_error.json @@ -0,0 +1,75 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Radio Mandatory with Overridden Error", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "radio", + "title": "Radio Mandatory with Overridden Error", + "blocks": [ + { + "type": "Question", + "id": "radio-mandatory", + "question": { + "type": "General", + "id": "radio-mandatory-question", + "title": "What is you favourite breakfast beverage?", + "answers": [ + { + "type": "Radio", + "id": "radio-mandatory-answer", + "mandatory": true, + "options": [ + { + "label": "Coffee", + "value": "Coffee" + }, + { + "label": "Tea", + "value": "Tea" + } + ], + "validation": { + "messages": { + "MANDATORY_RADIO": "Test error message is overridden" + } + } + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_radio_optional.json b/schemas/test/en/test_radio_optional.json new file mode 100644 index 0000000000..2e50644e9b --- /dev/null +++ b/schemas/test/en/test_radio_optional.json @@ -0,0 +1,70 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Radio Optional", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section-1", + "groups": [ + { + "id": "radio", + "title": "Radio Optional", + "blocks": [ + { + "type": "Question", + "id": "radio-non-mandatory", + "question": { + "type": "General", + "id": "radio-non-mandatory-question", + "title": "What is you favourite breakfast beverage?", + "answers": [ + { + "type": "Radio", + "id": "radio-non-mandatory-answer", + "mandatory": false, + "options": [ + { + "label": "Coffee", + "value": "Coffee" + }, + { + "label": "Tea", + "value": "Tea" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_radio_optional_with_detail_answer_mandatory.json b/schemas/test/en/test_radio_optional_with_detail_answer_mandatory.json new file mode 100644 index 0000000000..179f552dd5 --- /dev/null +++ b/schemas/test/en/test_radio_optional_with_detail_answer_mandatory.json @@ -0,0 +1,77 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Radio Optional with Mandatory Detail Answer", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "radio", + "title": "Radio Optional with Detail Answer", + "blocks": [ + { + "type": "Question", + "id": "radio-non-mandatory", + "question": { + "type": "General", + "id": "radio-non-mandatory-question", + "title": "What is you favourite breakfast item?", + "answers": [ + { + "type": "Radio", + "id": "radio-non-mandatory-answer", + "mandatory": true, + "options": [ + { + "label": "Toast", + "value": "Toast" + }, + { + "label": "Other", + "description": "This is mandatory.", + "value": "Other", + "detail_answer": { + "mandatory": false, + "id": "other-answer-non-mandatory", + "label": "Please specify other", + "type": "TextField" + } + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_radio_optional_with_detail_answer_mandatory_with_overridden_error.json b/schemas/test/en/test_radio_optional_with_detail_answer_mandatory_with_overridden_error.json new file mode 100644 index 0000000000..e9097bbab0 --- /dev/null +++ b/schemas/test/en/test_radio_optional_with_detail_answer_mandatory_with_overridden_error.json @@ -0,0 +1,82 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.2", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Radio Optional with Mandatory Detail Answer Overridden Error", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "radio", + "title": "Radio Optional with Mandatory Detail Answer Overridden Error", + "blocks": [ + { + "type": "Question", + "id": "radio-non-mandatory", + "question": { + "type": "General", + "id": "radio-non-mandatory-question", + "title": "What do you prefer for breakfast?", + "answers": [ + { + "type": "Radio", + "id": "radio-non-mandatory-answer", + "mandatory": true, + "options": [ + { + "label": "Toast", + "value": "Toast" + }, + { + "label": "Other", + "description": "This is mandatory.", + "value": "Other", + "detail_answer": { + "mandatory": true, + "id": "other-answer-non-mandatory", + "label": "Please specify other", + "type": "TextField", + "validation": { + "messages": { + "MANDATORY_TEXTFIELD": "Test error message is overridden" + } + } + } + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_radio_optional_with_detail_answer_optional.json b/schemas/test/en/test_radio_optional_with_detail_answer_optional.json new file mode 100644 index 0000000000..a31dc2488f --- /dev/null +++ b/schemas/test/en/test_radio_optional_with_detail_answer_optional.json @@ -0,0 +1,77 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Radio Optional with Optional Detail Answer", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "radio", + "title": "Radio Optional with Optional Detail Answer", + "blocks": [ + { + "type": "Question", + "id": "radio-non-mandatory", + "question": { + "type": "General", + "id": "radio-non-mandatory-question", + "title": "What do you prefer for breakfast?", + "answers": [ + { + "type": "Radio", + "id": "radio-non-mandatory-answer", + "mandatory": false, + "options": [ + { + "label": "Toast", + "value": "Toast" + }, + { + "label": "Other", + "description": "This is optional.", + "value": "Other", + "detail_answer": { + "mandatory": false, + "id": "other-answer-non-mandatory", + "label": "Please specify other", + "type": "TextField" + } + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_radio_voluntary.json b/schemas/test/en/test_radio_voluntary.json new file mode 100644 index 0000000000..53a7bc5a49 --- /dev/null +++ b/schemas/test/en/test_radio_voluntary.json @@ -0,0 +1,98 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Radio Voluntary", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section-1", + "groups": [ + { + "id": "radio", + "title": "Radio Voluntary", + "blocks": [ + { + "type": "Question", + "id": "radio-voluntary-true", + "question": { + "type": "General", + "id": "radio-voluntary-true-question", + "title": "What is your favourite drink?", + "answers": [ + { + "type": "Radio", + "id": "radio-voluntary-true-answer", + "mandatory": false, + "voluntary": true, + "options": [ + { + "label": "Coffee", + "value": "Coffee" + }, + { + "label": "Tea", + "value": "Tea" + } + ] + } + ] + } + }, + { + "type": "Question", + "id": "radio-voluntary-false", + "question": { + "type": "General", + "id": "radio-voluntary-false-question", + "title": "What is your favourite food?", + "answers": [ + { + "type": "Radio", + "id": "radio-voluntary-false-answer", + "mandatory": false, + "voluntary": false, + "options": [ + { + "label": "Ice cream", + "value": "Ice cream" + }, + { + "label": "Hamburger", + "value": "Hamburger" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_radio_voluntary_with_repeating_sections.json b/schemas/test/en/test_radio_voluntary_with_repeating_sections.json new file mode 100644 index 0000000000..9cd538c0f2 --- /dev/null +++ b/schemas/test/en/test_radio_voluntary_with_repeating_sections.json @@ -0,0 +1,245 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Repeating Section With Voluntary Radio", + "theme": "default", + "description": "A questionnaire to test clear voluntary radio fields functionality in repeating section", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section", + "title": "Household", + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone live here?", + "answers": [ + { + "id": "anyone-lives-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "personal-details-section", + "title": "Personal Details", + "summary": { "show_on_completion": true }, + "repeat": { + "for_list": "people", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "groups": [ + { + "id": "radio", + "title": "Radio Voluntary", + "blocks": [ + { + "type": "Question", + "id": "radio-voluntary", + "question": { + "type": "General", + "id": "radio-voluntary-question", + "title": "What is your favourite drink?", + "answers": [ + { + "type": "Radio", + "id": "radio-voluntary-answer", + "mandatory": false, + "voluntary": true, + "options": [ + { + "label": "Coffee", + "value": "Coffee" + }, + { + "label": "Tea", + "value": "Tea" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_relationships.json b/schemas/test/en/test_relationships.json new file mode 100644 index 0000000000..9054e842a7 --- /dev/null +++ b/schemas/test/en/test_relationships.json @@ -0,0 +1,934 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Relationships", + "theme": "default", + "description": "A questionnaire to test capturing of relationships.", + "messages": {}, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "summary": { + "show_on_completion": true, + "items": [ + { + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders", + "for_list": "people", + "title": "Household members", + "type": "List" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "Relationships", + "blocks": [ + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live at 1 Pleasant Lane?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person who isn’t you?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "People who live here", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "type": "RelationshipCollector", + "id": "relationships", + "title": "This will iterate over the people list, capturing the one way relationships.", + "for_list": "people", + "question": { + "id": "relationship-question", + "type": "General", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their ", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "answers": [ + { + "id": "relationship-answer", + "mandatory": true, + "type": "Relationship", + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} ", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "options": [ + { + "label": "Husband or Wife", + "value": "Husband or Wife", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their husband or wife", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} husband or wife", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + { + "label": "Legally registered civil partner", + "value": "Legally registered civil partner", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their legally registered civil partner", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} legally registered civil partner", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + { + "label": "Son or daughter", + "value": "Son or daughter", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their son or daughter", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} son or daughter", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + { + "label": "Brother or sister", + "value": "Brother or sister", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their brother or sister", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} brother or sister", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "description": "Including half brother or half sister" + } + ] + } + ] + }, + "skip_conditions": { + "when": { + "<": [ + { + "source": "list", + "identifier": "people", + "selector": "count" + }, + 2 + ] + } + } + }, + { + "id": "relationship-interstitial", + "content": { + "title": "Relationship section", + "contents": [ + { + "description": "You have successfully completed the relationship section." + } + ] + }, + "type": "Interstitial", + "skip_conditions": { + "when": { + "<": [ + { + "source": "list", + "identifier": "people", + "selector": "count" + }, + 2 + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_relationships_primary.json b/schemas/test/en/test_relationships_primary.json new file mode 100644 index 0000000000..2fe0d5149f --- /dev/null +++ b/schemas/test/en/test_relationships_primary.json @@ -0,0 +1,1364 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test PrimaryPersonListCollector", + "theme": "default", + "description": "A questionnaire to test Primary Person ListCollector", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": {} + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "id": "group", + "title": "Primary Person", + "blocks": [ + { + "id": "primary-person-list-collector", + "type": "PrimaryPersonListCollector", + "for_list": "people", + "add_or_edit_block": { + "id": "add-or-edit-primary-person", + "type": "PrimaryPersonListAddOrEditQuestion", + "question": { + "id": "primary-person-add-or-edit-question", + "type": "General", + "title": "What is your name", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "question": { + "id": "primary-confirmation-question", + "type": "General", + "title": "Do you live here?", + "answers": [ + { + "id": "you-live-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": { + "text": "Change details for {first_name} {last_name}", + "placeholders": [ + { + "placeholder": "first_name", + "value": { + "source": "answers", + "identifier": "first-name" + } + }, + { + "placeholder": "last_name", + "value": { + "source": "answers", + "identifier": "last-name" + } + } + ] + }, + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "type": "RelationshipCollector", + "id": "relationships", + "title": "This will iterate over the people list, capturing the one way relationships.", + "for_list": "people", + "question_variants": [ + { + "question": { + "id": "relationship-question", + "type": "General", + "title": { + "text": "{second_person_name} is your ", + "placeholders": [ + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "answers": [ + { + "id": "relationship-answer", + "mandatory": true, + "type": "Relationship", + "playback": { + "text": "{second_person_name} is your ", + "placeholders": [ + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "options": [ + { + "label": "Husband or Wife", + "value": "Husband or Wife", + "title": { + "text": "{second_person_name} is your husband or wife", + "placeholders": [ + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is your husband or wife", + "placeholders": [ + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + { + "label": "Legally registered civil partner", + "value": "Legally registered civil partner", + "title": { + "text": "{second_person_name} is your legally registered civil partner", + "placeholders": [ + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is your legally registered civil partner", + "placeholders": [ + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + { + "label": "Son or daughter", + "value": "Son or daughter", + "title": { + "text": "{second_person_name} is your son or daughter", + "placeholders": [ + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is your son or daughter", + "placeholders": [ + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + { + "label": "Brother or sister", + "value": "Brother or sister", + "title": { + "text": "{second_person_name} is your brother or sister", + "placeholders": [ + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is your brother or sister", + "placeholders": [ + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + } + } + ] + } + ] + }, + "when": { + "==": [ + { + "source": "list", + "identifier": "people", + "selector": "primary_person" + }, + { + "source": "location", + "identifier": "list_item_id" + } + ] + } + }, + { + "question": { + "id": "relationship-question", + "type": "General", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their ", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "answers": [ + { + "id": "relationship-answer", + "mandatory": true, + "type": "Relationship", + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} ", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "options": [ + { + "label": "Husband or Wife", + "value": "Husband or Wife", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their husband or wife", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} husband or wife", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + { + "label": "Legally registered civil partner", + "value": "Legally registered civil partner", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their legally registered civil partner", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} legally registered civil partner", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + { + "label": "Son or daughter", + "value": "Son or daughter", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their son or daughter", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} son or daughter", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + { + "label": "Brother or sister", + "value": "Brother or sister", + "title": { + "text": "Thinking of {first_person_name}, {second_person_name} is their brother or sister", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} brother or sister", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + } + } + ] + } + ] + }, + "when": { + "!=": [ + { + "identifier": "people", + "source": "list", + "selector": "primary_person" + }, + { + "source": "location", + "identifier": "list_item_id" + } + ] + } + } + ], + "skip_conditions": { + "when": { + "<": [ + { + "identifier": "people", + "source": "list", + "selector": "count" + }, + 2 + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_relationships_unrelated.json b/schemas/test/en/test_relationships_unrelated.json new file mode 100644 index 0000000000..ea03d61774 --- /dev/null +++ b/schemas/test/en/test_relationships_unrelated.json @@ -0,0 +1,855 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Relationships Unrelated Question", + "theme": "default", + "description": "A questionnaire to test capturing of relationships.", + "messages": {}, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "summary": { + "show_on_completion": true, + "items": [ + { + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders", + "for_list": "people", + "title": "Household members", + "type": "List" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "Relationships", + "blocks": [ + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live at 1 Pleasant Lane?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person who isn’t you?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "People who live here", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "type": "RelationshipCollector", + "id": "relationships", + "title": "This will iterate over the people list, capturing the one way relationships.", + "for_list": "people", + "question": { + "id": "relationship-question", + "type": "General", + "title": { + "text": "Thinking about {first_person_name}, {second_person_name} is their ", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "answers": [ + { + "id": "relationship-answer", + "mandatory": true, + "type": "Relationship", + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} ", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "options": [ + { + "label": "Husband or Wife", + "value": "Husband or Wife", + "title": { + "text": "Thinking about {first_person_name}, {second_person_name} is their husband or wife", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is {first_person_name_possessive} husband or wife", + "placeholders": [ + { + "placeholder": "first_person_name_possessive", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + }, + { + "transform": "format_possessive", + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + { + "label": "Unrelated", + "value": "Unrelated", + "title": { + "text": "Thinking about {first_person_name}, {second_person_name} is unrelated to {first_person_name}", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "playback": { + "text": "{second_person_name} is unrelated to {first_person_name}", + "placeholders": [ + { + "placeholder": "first_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + }, + { + "placeholder": "second_person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "to_list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ] + }, + "description": "Including half brother or half sister" + } + ] + } + ] + }, + "skip_conditions": { + "when": { + "<": [ + { + "identifier": "people", + "source": "list", + "selector": "count" + }, + 2 + ] + } + }, + "unrelated_block": { + "type": "UnrelatedQuestion", + "id": "related-to-anyone-else", + "page_title": "How person {list_item_position} is related to anyone else", + "title": "Related to anyone", + "list_summary": { + "for_list": "people", + "summary": { + "item_title": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ], + "text": "{person_name}" + } + } + }, + "question_variants": [ + { + "question": { + "id": "related-to-anyone-else-question", + "type": "General", + "title": "Are any of these people related to you?", + "guidance": { + "contents": [ + { + "description": "Remember to include partners, step-parents, and stepchildren as related" + } + ] + }, + "answers": [ + { + "id": "related-to-anyone-else-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveUnrelatedRelationships" + } + }, + { + "label": "No, none of these people are related to me", + "value": "No, none of these people are related to me", + "action": { + "type": "AddUnrelatedRelationships" + } + } + ] + } + ] + }, + "when": { + "==": [ + { + "identifier": "list_item_id", + "source": "location" + }, + { + "source": "list", + "identifier": "people", + "selector": "first" + } + ] + } + }, + { + "question": { + "id": "related-to-anyone-else-question", + "type": "General", + "title": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ], + "text": "Are any of these people related to {person_name}?" + }, + "guidance": { + "contents": [ + { + "description": "Remember to include partners, step-parents, and stepchildren as related" + } + ] + }, + "answers": [ + { + "id": "related-to-anyone-else-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveUnrelatedRelationships" + } + }, + { + "label": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + }, + { + "source": "answers", + "identifier": "last-name", + "list_item_selector": { + "source": "location", + "identifier": "list_item_id" + } + } + ], + "delimiter": " " + } + } + ] + } + ], + "text": "No, none of these people are related to {person_name}" + }, + "value": "No, none of these people are related to {person_name}", + "action": { + "type": "AddUnrelatedRelationships" + } + } + ] + } + ] + }, + "when": { + "!=": [ + { + "identifier": "list_item_id", + "source": "location" + }, + { + "source": "list", + "identifier": "people", + "selector": "first" + } + ] + } + } + ] + } + }, + { + "id": "relationship-interstitial", + "content": { + "title": "Relationship section", + "contents": [ + { + "description": "You have successfully completed the relationship section." + } + ] + }, + "type": "Interstitial", + "skip_conditions": { + "when": { + "<": [ + { + "source": "list", + "identifier": "people", + "selector": "count" + }, + 2 + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_repeating_section_summaries.json b/schemas/test/en/test_repeating_section_summaries.json new file mode 100644 index 0000000000..3ba64c74a9 --- /dev/null +++ b/schemas/test/en/test_repeating_section_summaries.json @@ -0,0 +1,411 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Repeating Section Summaries", + "theme": "default", + "description": "A questionnaire to repeating section summary functionality", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section", + "title": "Household", + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "primary-person-list-collector", + "type": "PrimaryPersonListCollector", + "for_list": "people", + "add_or_edit_block": { + "id": "add-or-edit-primary-person", + "type": "PrimaryPersonListAddOrEditQuestion", + "question": { + "id": "primary-person-add-or-edit-question", + "type": "General", + "title": "What is your name?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "question": { + "id": "primary-confirmation-question", + "type": "General", + "title": "Do you live here?", + "answers": [ + { + "id": "you-live-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "personal-details-section", + "title": "Personal Details", + "summary": { + "show_on_completion": true + }, + "repeat": { + "for_list": "people", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "groups": [ + { + "id": "personal-details-group", + "title": "Personal Details", + "blocks": [ + { + "id": "proxy", + "question": { + "answers": [ + { + "default": "Yes", + "id": "proxy-answer", + "mandatory": false, + "options": [ + { + "label": "No, I’m answering for myself", + "value": "No, I’m answering for myself" + }, + { + "label": "Yes", + "value": "Yes" + } + ], + "type": "Radio" + } + ], + "id": "proxy-question", + "title": "Are you answering the questions on behalf of someone else?", + "type": "General" + }, + "type": "Question" + }, + { + "id": "date-of-birth", + "question_variants": [ + { + "question": { + "answers": [ + { + "id": "date-of-birth-answer", + "mandatory": true, + "maximum": { + "value": "now" + }, + "minimum": { + "offset_by": { + "years": -115 + }, + "value": "2019-10-13" + }, + "type": "Date" + } + ], + "guidance": { + "contents": [ + { + "description": "For example 31 12 1970" + } + ] + }, + "id": "date-of-birth-question", + "title": "What is your date of birth?", + "type": "General" + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "proxy-answer" + }, + "No, I’m answering for myself" + ] + } + }, + { + "question": { + "answers": [ + { + "id": "date-of-birth-answer", + "mandatory": true, + "maximum": { + "value": "now" + }, + "type": "Date" + } + ], + "guidance": { + "contents": [ + { + "description": "For example 31 12 1970" + } + ] + }, + "id": "date-of-birth-question", + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "What is {person_name_possessive} date of birth?" + }, + "type": "General" + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "proxy-answer" + }, + "Yes" + ] + } + } + ], + "type": "Question" + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_repeating_sections_with_hub_and_spoke.json b/schemas/test/en/test_repeating_sections_with_hub_and_spoke.json new file mode 100644 index 0000000000..3d3e74cb38 --- /dev/null +++ b/schemas/test/en/test_repeating_sections_with_hub_and_spoke.json @@ -0,0 +1,1312 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Hub & Spoke", + "theme": "default", + "description": "A questionnaire to demo hub and spoke functionality", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": "Household members", + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + }, + { + "type": "List", + "for_list": "visitor", + "title": "Visitors", + "add_link_text": "Add a visitor", + "empty_list_text": "There are no visitors" + } + ] + }, + "id": "section", + "title": "Household", + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "primary-person-list-collector", + "type": "PrimaryPersonListCollector", + "for_list": "people", + "add_or_edit_block": { + "id": "add-or-edit-primary-person", + "type": "PrimaryPersonListAddOrEditQuestion", + "question": { + "id": "primary-person-add-or-edit-question", + "type": "General", + "title": "What is your name?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "question": { + "id": "primary-confirmation-question", + "type": "General", + "title": "Do you live here?", + "answers": [ + { + "id": "you-live-here", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + }, + { + "id": "extra-list-group", + "title": "Another List", + "blocks": [ + { + "id": "next-interstitial", + "content": { + "title": "Another list", + "contents": [ + { + "description": "You have added some people to the ‘people’ list. Next we’ll test another list collector adding to the same list. This should still have the same list of people." + } + ] + }, + "type": "Interstitial" + }, + { + "id": "another-list-collector-block", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "another-confirmation-question", + "type": "General", + "title": "This list collector will add to the same ‘people’ list. Add someone else?", + "answers": [ + { + "id": "another-anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "another-add-person", + "type": "ListAddQuestion", + "question": { + "id": "another-add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "another-edit-person", + "type": "ListEditQuestion", + "question": { + "id": "another-edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "another-remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "another-remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "another-remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + }, + { + "id": "visitors-list-group", + "title": "Visitors List", + "blocks": [ + { + "id": "visitors-block", + "type": "ListCollector", + "for_list": "visitor", + "question": { + "id": "visitors-confirmation-question", + "type": "General", + "title": "This is the visitors list collector. Add a visitor?", + "answers": [ + { + "id": "visitors-anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "visitors-add-person", + "type": "ListAddQuestion", + "question": { + "id": "visitors-add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "visitor-first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "visitor-last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "visitors-edit-person", + "type": "ListEditQuestion", + "question": { + "id": "visitors-edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "visitor-first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "visitor-last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "visitors-remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "visitors-remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "visitors-remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household visitors", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "visitor-first-name" + }, + { + "source": "answers", + "identifier": "visitor-last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "personal-details-section", + "title": "Personal Details", + "summary": { + "show_on_completion": true + }, + "repeat": { + "for_list": "people", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "groups": [ + { + "id": "personal-details-group", + "title": "Personal Details", + "blocks": [ + { + "id": "proxy", + "question": { + "answers": [ + { + "default": "Yes", + "id": "proxy-answer", + "mandatory": false, + "options": [ + { + "label": "No, I’m answering for myself", + "value": "No, I’m answering for myself" + }, + { + "label": "Yes", + "value": "Yes" + } + ], + "type": "Radio" + } + ], + "id": "proxy-question", + "title": "Are you answering the questions on behalf of someone else?", + "type": "General" + }, + "type": "Question" + }, + { + "id": "date-of-birth", + "question_variants": [ + { + "question": { + "answers": [ + { + "id": "date-of-birth-answer", + "mandatory": true, + "maximum": { + "value": "now" + }, + "minimum": { + "offset_by": { + "years": -115 + }, + "value": "2019-10-13" + }, + "type": "Date" + } + ], + "guidance": { + "contents": [ + { + "description": "For example 31 12 1970" + } + ] + }, + "id": "date-of-birth-question", + "title": "What is your date of birth?", + "type": "General" + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "proxy-answer" + }, + "No, I’m answering for myself" + ] + } + }, + { + "question": { + "answers": [ + { + "id": "date-of-birth-answer", + "mandatory": true, + "maximum": { + "value": "now" + }, + "minimum": { + "offset_by": { + "years": -115 + }, + "value": "2019-10-13" + }, + "type": "Date" + } + ], + "guidance": { + "contents": [ + { + "description": "For example 31 12 1970" + } + ] + }, + "id": "date-of-birth-question", + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "What is {person_name_possessive} date of birth?" + }, + "type": "General" + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "proxy-answer" + }, + "Yes" + ] + } + } + ], + "type": "Question" + }, + { + "id": "confirm-dob", + "question_variants": [ + { + "question": { + "answers": [ + { + "id": "confirm-date-of-birth-answer", + "mandatory": true, + "options": [ + { + "label": { + "placeholders": [ + { + "placeholder": "age", + "transforms": [ + { + "arguments": { + "first_date": { + "identifier": "date-of-birth-answer", + "source": "answers" + }, + "second_date": { + "value": "now" + } + }, + "transform": "calculate_date_difference" + } + ] + } + ], + "text": "Yes, I am {age} old" + }, + "value": "Yes, I am {age} old" + }, + { + "label": "No, I need to change my date of birth", + "value": "No, I need to change my date of birth" + } + ], + "type": "Radio" + } + ], + "id": "confirm-date-of-birth", + "title": { + "placeholders": [ + { + "placeholder": "age", + "transforms": [ + { + "arguments": { + "first_date": { + "identifier": "date-of-birth-answer", + "source": "answers" + }, + "second_date": { + "value": "now" + } + }, + "transform": "calculate_date_difference" + } + ] + } + ], + "text": "You are {age} old. Is this correct?" + }, + "type": "General" + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "proxy-answer" + }, + "No, I’m answering for myself" + ] + } + }, + { + "question": { + "answers": [ + { + "id": "confirm-date-of-birth-answer", + "mandatory": true, + "options": [ + { + "label": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + }, + { + "placeholder": "age", + "transforms": [ + { + "arguments": { + "first_date": { + "identifier": "date-of-birth-answer", + "source": "answers" + }, + "second_date": { + "value": "now" + } + }, + "transform": "calculate_date_difference" + } + ] + } + ], + "text": "Yes, {person_name} is {age} old" + }, + "value": "Yes, {person_name} is {age} old" + }, + { + "label": "No, I need to change their date of birth", + "value": "No, I need to change their date of birth" + } + ], + "type": "Radio" + } + ], + "id": "confirm-date-of-birth", + "title": { + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + }, + { + "placeholder": "age", + "transforms": [ + { + "arguments": { + "first_date": { + "identifier": "date-of-birth-answer", + "source": "answers" + }, + "second_date": { + "value": "now" + } + }, + "transform": "calculate_date_difference" + } + ] + } + ], + "text": "{person_name} is {age} old. Is this correct?" + }, + "type": "General" + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "proxy-answer" + }, + "Yes" + ] + } + } + ], + "routing_rules": [ + { + "block": "date-of-birth", + "when": { + "==": [ + { + "source": "answers", + "identifier": "confirm-date-of-birth-answer" + }, + "No, I need to change my date of birth" + ] + } + }, + { + "block": "date-of-birth", + "when": { + "==": [ + { + "source": "answers", + "identifier": "confirm-date-of-birth-answer" + }, + "No, I need to change their date of birth" + ] + } + }, + { + "block": "sex" + } + ], + "type": "ConfirmationQuestion" + }, + { + "id": "sex", + "question_variants": [ + { + "question": { + "answers": [ + { + "id": "sex-answer", + "mandatory": false, + "options": [ + { + "label": "Female", + "value": "Female" + }, + { + "label": "Male", + "value": "Male" + } + ], + "type": "Radio" + } + ], + "guidance": { + "contents": [ + { + "description": "A question about gender will follow" + } + ] + }, + "id": "sex-question", + "title": "What is your sex?", + "type": "General" + }, + "when": { + "and": [ + { + "==": [ + { + "source": "answers", + "identifier": "proxy-answer" + }, + "No, I’m answering for myself" + ] + }, + { + "<=": [ + { + "date": ["now", { "years": -16 }] + }, + { + "date": [ + { + "source": "answers", + "identifier": "date-of-birth-answer" + } + ] + } + ] + } + ] + } + }, + { + "question": { + "answers": [ + { + "id": "sex-answer", + "mandatory": false, + "options": [ + { + "label": "Female", + "value": "Female" + }, + { + "label": "Male", + "value": "Male" + } + ], + "type": "Radio" + } + ], + "guidance": { + "contents": [ + { + "description": "A question about gender will follow" + } + ] + }, + "id": "sex-question", + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "What is {person_name_possessive} sex?" + }, + "type": "General" + }, + "when": { + "and": [ + { + "==": [ + { + "source": "answers", + "identifier": "proxy-answer" + }, + "Yes" + ] + }, + { + "<=": [ + { + "date": ["now", { "years": -16 }] + }, + { + "date": [{ "source": "answers", "identifier": "date-of-birth-answer" }] + } + ] + } + ] + } + }, + { + "question": { + "answers": [ + { + "id": "sex-answer", + "mandatory": false, + "options": [ + { + "label": "Female", + "value": "Female" + }, + { + "label": "Male", + "value": "Male" + } + ], + "type": "Radio" + } + ], + "id": "sex-question", + "title": "What is your sex?", + "type": "General" + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "proxy-answer" + }, + "No, I’m answering for myself" + ] + } + }, + { + "question": { + "answers": [ + { + "id": "sex-answer", + "mandatory": false, + "options": [ + { + "label": "Female", + "value": "Female" + }, + { + "label": "Male", + "value": "Male" + } + ], + "type": "Radio" + } + ], + "id": "sex-question", + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "What is {person_name_possessive} sex?" + }, + "type": "General" + }, + "when": { + "==": [ + { + "source": "answers", + "identifier": "proxy-answer" + }, + "Yes" + ] + } + } + ], + "type": "Question" + } + ] + } + ] + }, + { + "id": "visitors-section", + "title": "Visitors", + "repeat": { + "for_list": "visitor", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "visitor-first-name" + }, + { + "source": "answers", + "identifier": "visitor-last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "groups": [ + { + "id": "visitors-group", + "title": "Visitors", + "blocks": [ + { + "id": "visitors-date-of-birth", + "type": "Question", + "question": { + "answers": [ + { + "id": "visitors-date-of-birth-answer", + "mandatory": true, + "maximum": { + "value": "now" + }, + "minimum": { + "offset_by": { + "years": -115 + }, + "value": "2019-10-13" + }, + "type": "Date" + } + ], + "guidance": { + "contents": [ + { + "description": "For example 31 12 1970" + } + ] + }, + "id": "visitors-date-of-birth-question", + "title": { + "placeholders": [ + { + "placeholder": "person_name_possessive", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "visitor-first-name" + }, + { + "source": "answers", + "identifier": "visitor-last-name" + } + ] + }, + "transform": "concatenate_list" + }, + { + "arguments": { + "string_to_format": { + "source": "previous_transform" + } + }, + "transform": "format_possessive" + } + ] + } + ], + "text": "What is {person_name_possessive} date of birth?" + }, + "type": "General" + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_and.json b/schemas/test/en/test_routing_and.json new file mode 100644 index 0000000000..89f0ea82b3 --- /dev/null +++ b/schemas/test/en/test_routing_and.json @@ -0,0 +1,180 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing And", + "theme": "default", + "description": "A test survey for routing based on the AND operator", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "number-question-1", + "question": { + "guidance": { + "contents": [ + { + "description": "Enter 123 here AND 321 on the next question to route to the “correct” page otherwise you will be routed to the “incorrect” page" + } + ] + }, + "answers": [ + { + "id": "answer-1", + "mandatory": true, + "type": "Number", + "label": "Enter 123" + } + ], + "id": "question-1", + "title": "Enter the number 123", + "type": "General" + } + }, + { + "type": "Question", + "id": "number-question-2", + "question": { + "answers": [ + { + "id": "answer-2", + "mandatory": true, + "type": "Number", + "label": "Enter 321" + } + ], + "id": "question-2", + "title": "Enter the number 321", + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + "and": [ + { + "==": [ + { + "source": "answers", + "identifier": "answer-1" + }, + 123 + ] + }, + { + "==": [ + { + "source": "answers", + "identifier": "answer-2" + }, + 321 + ] + } + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "You did not enter the correct answers", + "contents": [ + { + "description": { + "text": "You were asked to enter 123 and 321 but you actually entered {answer_1} and {answer_2}.", + "placeholders": [ + { + "placeholder": "answer_1", + "value": { + "source": "answers", + "identifier": "answer-1" + } + }, + { + "placeholder": "answer_2", + "value": { + "source": "answers", + "identifier": "answer-2" + } + } + ] + } + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "Correct", + "contents": [ + { + "description": { + "text": "You were asked to enter 123 and 321 and you entered {answer_1} and {answer_2}.", + "placeholders": [ + { + "placeholder": "answer_1", + "value": { + "source": "answers", + "identifier": "answer-1" + } + }, + { + "placeholder": "answer_2", + "value": { + "source": "answers", + "identifier": "answer-2" + } + } + ] + } + } + ] + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_and_skipping_section_dependencies.json b/schemas/test/en/test_routing_and_skipping_section_dependencies.json new file mode 100644 index 0000000000..0987ace23f --- /dev/null +++ b/schemas/test/en/test_routing_and_skipping_section_dependencies.json @@ -0,0 +1,707 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Routing and Skipping Section Dependencies", + "theme": "default", + "description": "A questionnaire to test routing and skipping rules, when the rule references a different section to its current section", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "title": "Skip question", + "summary": { "show_on_completion": true }, + "id": "skip-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "skip-age", + "question": { + "answers": [ + { + "id": "skip-age-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "skip-age-question", + "title": "Do you want to skip all age questions in all sections", + "type": "General" + } + }, + { + "type": "Question", + "id": "skip-household-section", + "question": { + "id": "skip-household-section-question", + "title": "Do you want to skip the question about skipping the household summary section?", + "type": "General", + "answers": [ + { + "id": "skip-household-section-answer", + "label": "It will remove the enable section question from the routing path", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ] + } + }, + { + "type": "Question", + "id": "enable-section", + "question": { + "id": "enable-section-question", + "title": "Do you want to enable the household summary section?", + "type": "General", + "answers": [ + { + "id": "enable-section-answer", + "label": "Depending on the answer it will enable or disable the household summary section", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ] + }, + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "skip-household-section-answer", + "source": "answers" + }, + "Yes" + ] + } + } + } + ], + "id": "skip-age-group" + } + ] + }, + { + "title": "Skip question confirmation", + "summary": { "show_on_completion": true }, + "id": "skip-confirmation-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "security", + "question": { + "answers": [ + { + "id": "security-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "security-question", + "title": "You understand that your personal details will be held securely and not shared with anyone?", + "type": "General" + }, + "routing_rules": [ + { + "block": "skip-confirmation", + "when": { + "==": [ + "Yes", + { + "source": "answers", + "identifier": "skip-age-answer" + } + ] + } + }, + { + "section": "End" + } + ] + }, + { + "type": "Question", + "id": "skip-confirmation", + "question": { + "answers": [ + { + "id": "skip-confirmation-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "skip-confirmation-question", + "title": "Are you sure you want to skip all age questions in all sections?", + "type": "General" + } + } + ], + "id": "skip-confirmation-group" + } + ] + }, + { + "title": "Primary Person", + "summary": { "show_on_completion": true }, + "id": "primary-person", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "name-block", + "question": { + "answers": [ + { + "label": "Full Name", + "id": "name-answer", + "mandatory": false, + "type": "TextField" + } + ], + "id": "name-question", + "title": "What is your name?", + "type": "General" + } + }, + { + "type": "Question", + "id": "age", + "question": { + "answers": [ + { + "label": "Age in years", + "id": "age-answer", + "mandatory": false, + "type": "Number" + } + ], + "id": "age-question", + "title": "What is your age?", + "type": "General" + }, + "skip_conditions": { + "when": { + "and": [ + { + "==": [ + { + "source": "answers", + "identifier": "skip-age-answer" + }, + "Yes" + ] + }, + { + "!=": [ + { + "source": "answers", + "identifier": "skip-confirmation-answer" + }, + "No" + ] + } + ] + } + } + } + ], + "id": "primary-person-group", + "title": "Primary Person" + }, + { + "blocks": [ + { + "type": "Question", + "id": "reason-no-confirmation", + "question": { + "answers": [ + { + "id": "reason-no-confirmation-answer", + "mandatory": false, + "options": [ + { + "label": "I did not visit section 2, so confirmation was not needed", + "value": "I did not visit section 2, so confirmation was not needed" + }, + { + "label": "I did, but it was removed from the path as I changed my answer to No on the skip question", + "value": "I did, but it was removed from the path as I changed my answer to No on the skip question" + } + ], + "type": "Radio" + } + ], + "id": "reason-no-confirmation-question", + "title": "Why did you not answer the age skipping confirmation question?", + "type": "General" + } + } + ], + "id": "confirmation-group", + "title": "Confirmation Question", + "skip_conditions": { + "when": { + "or": [ + { + "==": [ + { + "source": "answers", + "identifier": "skip-confirmation-answer" + }, + "Yes" + ] + }, + { + "==": [ + { + "source": "answers", + "identifier": "skip-confirmation-answer" + }, + "No" + ] + } + ] + } + } + } + ] + }, + { + "enabled": { + "when": { + "==": [ + "Yes", + { + "source": "answers", + "identifier": "enable-section-answer" + } + ] + } + }, + "id": "household-section", + "title": "Household Summary", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": "Household members", + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "cancel_text": "Don’t need to add anyone else?", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "cancel_text": "Don’t need to change anything?", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "cancel_text": "Don’t need to remove this person?", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "warning": "All of the information about this person will be deleted", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "household-personal-details-section", + "title": "Personal Details", + "summary": { "show_on_completion": true }, + "repeat": { + "for_list": "people", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "groups": [ + { + "id": "personal-details-group", + "title": "Personal Details", + "blocks": [ + { + "id": "repeating-sex", + "question": { + "answers": [ + { + "id": "repeating-sex-answer", + "mandatory": false, + "options": [ + { + "label": "Male", + "value": "Male" + }, + { + "label": "Female", + "value": "Female" + } + ], + "type": "Radio" + } + ], + "id": "repeating-sex-question", + "title": "What sex is this person?", + "type": "General" + }, + "type": "Question" + }, + { + "type": "Question", + "id": "repeating-age", + "question": { + "answers": [ + { + "label": "Age in years", + "id": "repeating-age-answer", + "mandatory": false, + "type": "Number" + } + ], + "id": "repeating-age-question", + "title": "What age is this person?", + "type": "General" + }, + "skip_conditions": { + "when": { + "and": [ + { + "==": [ + { + "source": "answers", + "identifier": "skip-age-answer" + }, + "Yes" + ] + }, + { + "!=": [ + { + "source": "answers", + "identifier": "skip-confirmation-answer" + }, + "No" + ] + } + ] + } + } + }, + { + "id": "repeating-is-dependent", + "question": { + "answers": [ + { + "id": "repeating-is-dependent-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + }, + { + "label": "Prefer not to say", + "value": "Prefer not to say" + } + ], + "type": "Radio" + } + ], + "id": "repeating-is-dependent-question", + "title": "Is this person dependent on you?", + "type": "General" + }, + "type": "Question" + }, + { + "id": "repeating-is-smoker", + "question": { + "answers": [ + { + "id": "repeating-is-smoker-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + }, + { + "label": "Prefer not to say", + "value": "Prefer not to say" + } + ], + "type": "Radio" + } + ], + "id": "repeating-is-smoker-question", + "title": "Is this person smoke or use nicotine products?", + "type": "General" + }, + "type": "Question", + "skip_conditions": { + "when": { + "or": [ + { + "==": [ + { + "source": "answers", + "identifier": "skip-age-answer" + }, + "Yes" + ] + }, + { + "<=": [ + { + "source": "answers", + "identifier": "repeating-age-answer" + }, + 18 + ] + } + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_and_skipping_section_dependencies_calculated_summary.json b/schemas/test/en/test_routing_and_skipping_section_dependencies_calculated_summary.json new file mode 100644 index 0000000000..adf631db12 --- /dev/null +++ b/schemas/test/en/test_routing_and_skipping_section_dependencies_calculated_summary.json @@ -0,0 +1,338 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Routing and Skipping Section Dependencies based on Calculated Summary", + "theme": "default", + "description": "A questionnaire to test routing and skipping rules, when the rule references a different section to its current section", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "title": "Calculated Summary Section", + "summary": { "show_on_completion": true }, + "id": "calculated-summary-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "first-question-block", + "question": { + "id": "first-question", + "title": "How much do you spend on the following items?", + "description": [ + "If the total is equal to £100 a new section will appear on the hub and if it is greater than or equal to £100 a dependent question will appear in the dependent question section" + ], + "type": "General", + "answers": [ + { + "id": "milk-answer", + "label": "Milk", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "eggs-answer", + "label": "Eggs", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "bread-answer", + "label": "Bread", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "cheese-answer", + "label": "Cheese", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "skip-butter-block", + "question": { + "type": "General", + "id": "skip-butter-block-question", + "title": "Skip optional question about butter so that it doesn’t appear in the Total?", + "answers": [ + { + "type": "Radio", + "id": "skip-butter-block-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "skip-butter-block-answer", + "source": "answers" + }, + "Yes" + ] + } + }, + "type": "Question", + "id": "butter-block", + "question": { + "id": "butter-question", + "title": "How much do you spend on butter?", + "type": "General", + "answers": [ + { + "id": "butter-answer", + "label": "Butter", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "currency-total-playback", + "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", + "calculation": { + "calculation_type": "sum", + "answers_to_calculate": ["milk-answer", "eggs-answer", "bread-answer", "cheese-answer", "butter-answer"], + "title": "Grand total of previous values" + } + } + ], + "id": "calculated-summary-group" + } + ] + }, + { + "title": "Dependent question Section", + "summary": { "show_on_completion": true }, + "id": "dependent-question-section", + "groups": [ + { + "blocks": [ + { + "skip_conditions": { + "when": { + ">=": [ + { + "source": "calculated_summary", + "identifier": "currency-total-playback" + }, + 10 + ] + } + }, + "type": "Question", + "id": "fruit", + "question": { + "answers": [ + { + "id": "fruit-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "fruit-question", + "title": "Do you like eating fruit", + "type": "General" + } + }, + { + "routing_rules": [ + { + "block": "second-question-block", + "when": { + ">=": [ + { + "source": "calculated_summary", + "identifier": "currency-total-playback" + }, + 100 + ] + } + }, + { + "section": "End" + } + ], + "type": "Question", + "id": "vegetables", + "question": { + "answers": [ + { + "id": "vegetables-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "vegetables-question", + "title": "Do you like eating vegetables", + "type": "General" + } + }, + { + "type": "Question", + "id": "second-question-block", + "question": { + "id": "second-question", + "title": "How much do you spend on the following items?", + "type": "General", + "answers": [ + { + "id": "apples-answer", + "label": "Apples", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "bananas-answer", + "label": "Bananas", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "oranges-answer", + "label": "Oranges", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "lemons-answer", + "label": "Lemons", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + } + ], + "id": "dependent-question-group" + } + ] + }, + { + "enabled": { + "when": { + "==": [ + 100, + { + "source": "calculated_summary", + "identifier": "currency-total-playback" + } + ] + } + }, + "title": "Dependent Enabled Section", + "summary": { "show_on_completion": true }, + "id": "dependent-enabled-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "desserts", + "question": { + "answers": [ + { + "id": "desserts-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "desserts-question", + "title": "Do you like eating desserts", + "type": "General" + } + } + ], + "id": "dependent-enabled-section-group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_and_skipping_section_dependencies_new_calculated_summary.json b/schemas/test/en/test_routing_and_skipping_section_dependencies_new_calculated_summary.json new file mode 100644 index 0000000000..4de0f7aeb3 --- /dev/null +++ b/schemas/test/en/test_routing_and_skipping_section_dependencies_new_calculated_summary.json @@ -0,0 +1,360 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Routing and Skipping Section Dependencies based on Calculated Summary", + "theme": "default", + "description": "A questionnaire to test routing and skipping rules, when the rule references a different section to its current section", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "title": "Calculated Summary Section", + "summary": { "show_on_completion": true }, + "id": "calculated-summary-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "first-question-block", + "question": { + "id": "first-question", + "title": "How much do you spend on the following items?", + "description": [ + "If the total is equal to £100 a new section will appear on the hub and if it is less than or equal to £10 a dependent question will appear in the dependent question section" + ], + "type": "General", + "answers": [ + { + "id": "milk-answer", + "label": "Milk", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "eggs-answer", + "label": "Eggs", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "bread-answer", + "label": "Bread", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "cheese-answer", + "label": "Cheese", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "skip-butter-block", + "question": { + "type": "General", + "id": "skip-butter-block-question", + "title": "Skip optional question about butter so that it doesn’t appear in the Total?", + "answers": [ + { + "type": "Radio", + "id": "skip-butter-block-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "skip-butter-block-answer", + "source": "answers" + }, + "Yes" + ] + } + }, + "type": "Question", + "id": "butter-block", + "question": { + "id": "butter-question", + "title": "How much do you spend on butter?", + "type": "General", + "answers": [ + { + "id": "butter-answer", + "label": "Butter", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "currency-total-playback", + "title": "We calculate the total of currency values entered to be %(total)s. Is this correct?", + "calculation": { + "operation": { + "+": [ + { + "source": "answers", + "identifier": "milk-answer" + }, + { + "source": "answers", + "identifier": "eggs-answer" + }, + { + "source": "answers", + "identifier": "bread-answer" + }, + { + "source": "answers", + "identifier": "cheese-answer" + }, + { + "source": "answers", + "identifier": "butter-answer" + } + ] + }, + "title": "Grand total of previous values" + } + } + ], + "id": "calculated-summary-group" + } + ] + }, + { + "title": "Dependent question Section", + "summary": { "show_on_completion": true }, + "id": "dependent-question-section", + "groups": [ + { + "blocks": [ + { + "skip_conditions": { + "when": { + ">=": [ + { + "source": "calculated_summary", + "identifier": "currency-total-playback" + }, + 10 + ] + } + }, + "type": "Question", + "id": "fruit", + "question": { + "answers": [ + { + "id": "fruit-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "fruit-question", + "title": "Do you like eating fruit", + "type": "General" + } + }, + { + "routing_rules": [ + { + "block": "second-question-block", + "when": { + ">=": [ + { + "source": "calculated_summary", + "identifier": "currency-total-playback" + }, + 100 + ] + } + }, + { + "section": "End" + } + ], + "type": "Question", + "id": "vegetables", + "question": { + "answers": [ + { + "id": "vegetables-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "vegetables-question", + "title": "Do you like eating vegetables", + "type": "General" + } + }, + { + "type": "Question", + "id": "second-question-block", + "question": { + "id": "second-question", + "title": "How much do you spend on the following items?", + "type": "General", + "answers": [ + { + "id": "apples-answer", + "label": "Apples", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "bananas-answer", + "label": "Bananas", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "oranges-answer", + "label": "Oranges", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "lemons-answer", + "label": "Lemons", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + } + ], + "id": "dependent-question-group" + } + ] + }, + { + "enabled": { + "when": { + "==": [ + 100, + { + "source": "calculated_summary", + "identifier": "currency-total-playback" + } + ] + } + }, + "title": "Dependent Enabled Section", + "summary": { "show_on_completion": true }, + "id": "dependent-enabled-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "desserts", + "question": { + "answers": [ + { + "id": "desserts-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "desserts-question", + "title": "Do you like eating desserts", + "type": "General" + } + } + ], + "id": "dependent-enabled-section-group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_answer_comparison.json b/schemas/test/en/test_routing_answer_comparison.json new file mode 100644 index 0000000000..9b89ca4491 --- /dev/null +++ b/schemas/test/en/test_routing_answer_comparison.json @@ -0,0 +1,124 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Answer Comparisons", + "theme": "default", + "legal_basis": "StatisticsOfTradeAct", + "description": "A test survey for routing based comparison with answers", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "route-group", + "blocks": [ + { + "type": "Question", + "id": "route-comparison-1", + "question": { + "answers": [ + { + "id": "route-comparison-1-answer", + "label": "1st Number", + "mandatory": true, + "type": "Number" + } + ], + "id": "route-comparison-1-question", + "title": "Enter your first number", + "type": "General" + } + }, + { + "type": "Question", + "id": "route-comparison-2", + "question": { + "answers": [ + { + "id": "route-comparison-2-answer", + "label": "2nd Number", + "mandatory": true, + "type": "Number" + } + ], + "id": "route-comparison-2-question", + "title": "Enter a higher number to skip the next interstitial", + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + ">": [ + { + "source": "answers", + "identifier": "route-comparison-2-answer" + }, + { + "source": "answers", + "identifier": "route-comparison-1-answer" + } + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "Your second number was lower or equal", + "contents": [ + { + "description": "This page should be skipped if your second answer was higher than your first" + } + ] + } + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "Your second number was higher", + "contents": [ + { + "description": "This page should never be skipped" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_answered_unanswered.json b/schemas/test/en/test_routing_answered_unanswered.json new file mode 100644 index 0000000000..ad598a5a8b --- /dev/null +++ b/schemas/test/en/test_routing_answered_unanswered.json @@ -0,0 +1,242 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.2", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Routing answered/unanswered", + "theme": "default", + "description": "A questionnaire to demo routing when question answered/unanswered", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "block-1", + "question": { + "guidance": { + "contents": [ + { + "description": "Select at least one option to route to the “answered” page otherwise you will be routed to the “unanswered” page" + } + ] + }, + "answers": [ + { + "id": "answer-1", + "mandatory": false, + "options": [ + { + "label": "Cheese", + "value": "Cheese" + }, + { + "label": "Ham", + "value": "Ham" + } + ], + "type": "Checkbox" + } + ], + "id": "question-1", + "title": "What is your favourite pizza topping?", + "type": "General" + }, + "routing_rules": [ + { + "block": "unanswered-question-1", + "when": { + "==": [ + { + "source": "answers", + "identifier": "answer-1" + }, + null + ] + } + }, + { + "block": "answered-question-1" + } + ] + }, + { + "id": "answered-question-1", + "type": "Interstitial", + "content": { + "title": "You answered the first question!" + }, + "routing_rules": [ + { + "block": "block-2" + } + ] + }, + { + "id": "unanswered-question-1", + "type": "Interstitial", + "content": { + "title": "You did not answer the first question!" + } + }, + { + "type": "Question", + "id": "block-2", + "question": { + "guidance": { + "contents": [ + { + "description": "Select at least one option to route to the “answered” page otherwise you will be routed to the “unanswered” page" + } + ] + }, + "answers": [ + { + "id": "answer-2", + "mandatory": false, + "options": [ + { + "label": "Pizza Hut", + "value": "Pizza Hut" + }, + { + "label": "Domino’s", + "value": "Domino’s" + } + ], + "type": "Checkbox" + } + ], + "id": "question-2", + "title": "What is your favourite pizza place?", + "type": "General" + }, + "routing_rules": [ + { + "block": "answered-question-2", + "when": { + "!=": [ + { + "source": "answers", + "identifier": "answer-2" + }, + null + ] + } + }, + { + "block": "unanswered-question-2" + } + ] + }, + { + "id": "answered-question-2", + "type": "Interstitial", + "content": { + "title": "You answered the second question!" + }, + "routing_rules": [ + { + "block": "block-3" + } + ] + }, + { + "id": "unanswered-question-2", + "type": "Interstitial", + "content": { + "title": "You did not answer the second question!" + } + }, + { + "type": "Question", + "id": "block-3", + "question": { + "guidance": { + "contents": [ + { + "description": "Enter a number greater than “0” to route to the “answered” page otherwise you will be routed to the “unanswered or answered 0” page" + } + ] + }, + "answers": [ + { + "id": "answer-3", + "mandatory": false, + "type": "Number", + "label": "Number of slices" + } + ], + "id": "question-3", + "title": "How many pizza slices would you like?", + "type": "General" + }, + "routing_rules": [ + { + "block": "unanswered-or-zero-question-3", + "when": { + "in": [ + { + "source": "answers", + "identifier": "answer-3" + }, + [null, 0] + ] + } + }, + { + "block": "answered-question-3" + } + ] + }, + { + "id": "answered-question-3", + "type": "Interstitial", + "content": { + "title": "You chose at least 1 slice" + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "id": "unanswered-or-zero-question-3", + "type": "Interstitial", + "content": { + "title": "You did not answer the question or chose 0 slices" + } + } + ], + "id": "default-group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_case_insensitive_text_field.json b/schemas/test/en/test_routing_case_insensitive_text_field.json new file mode 100644 index 0000000000..2b910c9284 --- /dev/null +++ b/schemas/test/en/test_routing_case_insensitive_text_field.json @@ -0,0 +1,125 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.2", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Routing is case insensitive for text fields", + "theme": "default", + "description": "A questionnaire to test case insensitive routing on text fields", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "country-text-field", + "question": { + "id": "country-text-field-question", + "title": "Name a country you have visited", + "type": "General", + "answers": [ + { + "id": "country-text-field-answer", + "label": "Country", + "mandatory": true, + "type": "TextField" + } + ], + "guidance": { + "contents": [ + { + "title": "The following routing should take place", + "list": [ + "Submit ‘India’ or ‘Azerbaijan’ using any mixture of lower or upper case: route to ‘country-interstitial-india-or-azerbaijan’", + "Submit ‘Georgia’ using any mixture of lower or upper case: route to ‘country-interstitial-georgia’" + ] + } + ] + } + }, + "routing_rules": [ + { + "block": "country-interstitial-india-or-azerbaijan", + "when": { + "in": [ + { + "identifier": "country-text-field-answer", + "source": "answers" + }, + ["India", "Azerbaijan"] + ] + } + }, + { + "block": "country-interstitial-georgia", + "when": { + "==": [ + { + "identifier": "country-text-field-answer", + "source": "answers" + }, + "Georgia" + ] + } + }, + { + "section": "End" + } + ] + }, + { + "id": "country-interstitial-georgia", + "type": "Interstitial", + "content": { + "title": "Condition: Submitted Georgia", + "contents": [ + { + "description": "You submitted Georgia." + } + ] + } + }, + { + "id": "country-interstitial-india-or-azerbaijan", + "type": "Interstitial", + "content": { + "title": "Condition: Submitted India or Azerbaijan", + "contents": [ + { + "description": "You submitted India or Azerbaijan." + } + ] + } + } + ], + "id": "countries-visited" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_checkbox_contains.json b/schemas/test/en/test_routing_checkbox_contains.json new file mode 100644 index 0000000000..cf16b416ac --- /dev/null +++ b/schemas/test/en/test_routing_checkbox_contains.json @@ -0,0 +1,131 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.2", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Other input fields", + "theme": "default", + "description": "A questionnaire to demo checkbox field combined contains routing", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "country-checkbox", + "question": { + "id": "country-checkbox-question", + "title": "Have you visited any of the following countries?", + "type": "General", + "answers": [ + { + "id": "country-checkbox-answer", + "mandatory": false, + "type": "Checkbox", + "options": [ + { + "label": "India", + "value": "India" + }, + { + "label": "Azerbaijan", + "value": "Azerbaijan" + }, + { + "label": "Liechtenstein", + "value": "Liechtenstein" + }, + { + "label": "Malta", + "value": "Malta" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "country-interstitial-all", + "when": { + "all-in": [ + ["India", "Azerbaijan", "Liechtenstein"], + { + "identifier": "country-checkbox-answer", + "source": "answers" + } + ] + } + }, + { + "block": "country-interstitial-any", + "when": { + "any-in": [ + { + "identifier": "country-checkbox-answer", + "source": "answers" + }, + ["India", "Azerbaijan"] + ] + } + }, + { + "section": "End" + } + ] + }, + { + "id": "country-interstitial-any", + "type": "Interstitial", + "content": { + "title": "Condition: Contains Any", + "contents": [ + { + "description": "You chose India or Azerbaijan." + } + ] + } + }, + { + "id": "country-interstitial-all", + "type": "Interstitial", + "content": { + "title": "Condition: Contains All", + "contents": [ + { + "description": "You chose India, Azerbaijan and Liechtenstein." + } + ] + } + } + ], + "id": "checkboxes" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_checkbox_contains_all.json b/schemas/test/en/test_routing_checkbox_contains_all.json new file mode 100644 index 0000000000..20facd96c2 --- /dev/null +++ b/schemas/test/en/test_routing_checkbox_contains_all.json @@ -0,0 +1,137 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing ALL-IN", + "theme": "default", + "description": "A test survey for routing based on the ALL-IN operator", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "country-checkbox", + "question": { + "id": "country-checkbox-question", + "title": "Have you visited any of the following countries?", + "type": "General", + "guidance": { + "contents": [ + { + "description": "Choose India and Malta here to route to the “correct” page otherwise you will be routed to the “incorrect” page" + } + ] + }, + "answers": [ + { + "id": "country-checkbox-answer", + "mandatory": false, + "type": "Checkbox", + "instruction": "Select India and Malta", + "options": [ + { + "label": "India", + "value": "India" + }, + { + "label": "Azerbaijan", + "value": "Azerbaijan" + }, + { + "label": "Liechtenstein", + "value": "Liechtenstein" + }, + { + "label": "Malta", + "value": "Malta" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "country-interstitial-india-and-malta", + "when": { + "all-in": [ + ["India", "Malta"], + { + "source": "answers", + "identifier": "country-checkbox-answer" + } + ] + } + }, + { + "block": "country-interstitial-not-india-and-malta" + } + ] + }, + { + "id": "country-interstitial-not-india-and-malta", + "type": "Interstitial", + "content": { + "title": "Condition: Does Not Contain India And Malta", + "contents": [ + { + "description": "You did not chose India and Malta." + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "id": "country-interstitial-india-and-malta", + "type": "Interstitial", + "content": { + "title": "Condition: Contained India And Malta", + "contents": [ + { + "description": "You chose India and Malta." + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + } + ], + "id": "checkboxes" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_checkbox_contains_any.json b/schemas/test/en/test_routing_checkbox_contains_any.json new file mode 100644 index 0000000000..11cf519b25 --- /dev/null +++ b/schemas/test/en/test_routing_checkbox_contains_any.json @@ -0,0 +1,137 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing ANY-IN", + "theme": "default", + "description": "A test survey for routing based on the ANY-IN operator", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "country-checkbox", + "question": { + "id": "country-checkbox-question", + "title": "Have you visited any of the following countries?", + "type": "General", + "guidance": { + "contents": [ + { + "description": "Choose India or Malta (or both) here to route to the “correct” page otherwise you will be routed to the “incorrect” page" + } + ] + }, + "answers": [ + { + "id": "country-checkbox-answer", + "mandatory": false, + "type": "Checkbox", + "instruction": "Select India or Malta (or both)", + "options": [ + { + "label": "India", + "value": "India" + }, + { + "label": "Azerbaijan", + "value": "Azerbaijan" + }, + { + "label": "Liechtenstein", + "value": "Liechtenstein" + }, + { + "label": "Malta", + "value": "Malta" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "country-interstitial-india-or-malta-or-both", + "when": { + "any-in": [ + ["India", "Malta"], + { + "source": "answers", + "identifier": "country-checkbox-answer" + } + ] + } + }, + { + "block": "country-interstitial-not-india-or-malta-or-both" + } + ] + }, + { + "id": "country-interstitial-not-india-or-malta-or-both", + "type": "Interstitial", + "content": { + "title": "Condition: Does Not Contain India Or Malta (Or Both)", + "contents": [ + { + "description": "You did not chose India or Malta (or both)." + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "id": "country-interstitial-india-or-malta-or-both", + "type": "Interstitial", + "content": { + "title": "Condition: Contained India Or Malta (Or Both)", + "contents": [ + { + "description": "You chose India or Malta (or both)." + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + } + ], + "id": "checkboxes" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_checkbox_contains_in.json b/schemas/test/en/test_routing_checkbox_contains_in.json new file mode 100644 index 0000000000..9bb14e81bf --- /dev/null +++ b/schemas/test/en/test_routing_checkbox_contains_in.json @@ -0,0 +1,137 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing IN", + "theme": "default", + "description": "A test survey for routing based on the IN operator", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "country-checkbox", + "question": { + "id": "country-checkbox-question", + "title": "Have you visited any of the following countries?", + "type": "General", + "guidance": { + "contents": [ + { + "description": "Choose India here to route to the “correct” page otherwise you will be routed to the “incorrect” page" + } + ] + }, + "answers": [ + { + "id": "country-checkbox-answer", + "mandatory": false, + "type": "Checkbox", + "instruction": "Select India", + "options": [ + { + "label": "India", + "value": "India" + }, + { + "label": "Azerbaijan", + "value": "Azerbaijan" + }, + { + "label": "Liechtenstein", + "value": "Liechtenstein" + }, + { + "label": "Malta", + "value": "Malta" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "country-interstitial-india", + "when": { + "in": [ + "India", + { + "source": "answers", + "identifier": "country-checkbox-answer" + } + ] + } + }, + { + "block": "country-interstitial-not-india" + } + ] + }, + { + "id": "country-interstitial-not-india", + "type": "Interstitial", + "content": { + "title": "Condition: Does Not Contain India", + "contents": [ + { + "description": "You did not chose India." + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "id": "country-interstitial-india", + "type": "Interstitial", + "content": { + "title": "Condition: Contained India", + "contents": [ + { + "description": "You chose India." + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + } + ], + "id": "checkboxes" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_checkbox_count.json b/schemas/test/en/test_routing_checkbox_count.json new file mode 100644 index 0000000000..cd351370e2 --- /dev/null +++ b/schemas/test/en/test_routing_checkbox_count.json @@ -0,0 +1,169 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Checkbox Count", + "theme": "default", + "description": "A test survey for routing based on checkbox count", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "topping-checkbox", + "question": { + "answers": [ + { + "id": "topping-checkbox-answer", + "mandatory": false, + "instruction": "Please select 2 or more", + "options": [ + { + "label": "Cheese", + "value": "Cheese" + }, + { + "label": "Ham", + "value": "Ham" + }, + { + "label": "Pineapple", + "value": "Pineapple" + }, + { + "label": "Tuna", + "value": "Tuna" + }, + { + "label": "Pepperoni", + "value": "Pepperoni" + } + ], + "type": "Checkbox" + } + ], + "id": "topping-checkbox-question", + "title": "What extra toppings would you like?", + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + ">=": [ + { + "count": [ + { + "source": "answers", + "identifier": "topping-checkbox-answer" + } + ] + }, + 2 + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "You did not select 2 or more toppings", + "contents": [ + { + "description": { + "text": "You were asked to select 2 or more toppings but you actually selected {answer_count}.", + "placeholders": [ + { + "placeholder": "answer_count", + "transforms": [ + { + "transform": "list_item_count", + "arguments": { + "list_to_count": { + "source": "answers", + "identifier": "topping-checkbox-answer" + } + } + } + ] + } + ] + } + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "You selected 2 or more toppings", + "contents": [ + { + "description": { + "text": "You were asked to select 2 or more toppings and you selected {answer_count}.", + "placeholders": [ + { + "placeholder": "answer_count", + "transforms": [ + { + "transform": "list_item_count", + "arguments": { + "list_to_count": { + "source": "answers", + "identifier": "topping-checkbox-answer" + } + } + } + ] + } + ] + } + } + ] + } + } + ], + "id": "checkboxes" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_date_equals.json b/schemas/test/en/test_routing_date_equals.json new file mode 100644 index 0000000000..3101d2760d --- /dev/null +++ b/schemas/test/en/test_routing_date_equals.json @@ -0,0 +1,311 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Date Equals", + "theme": "default", + "description": "A test survey for routing based on equal dates", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "comparison-date-block", + "question": { + "answers": [ + { + "id": "comparison-date-answer", + "mandatory": true, + "type": "Date" + } + ], + "id": "comparison-date-question", + "title": "Title", + "type": "General", + "guidance": { + "contents": [ + { + "title": "If you enter 31/03/2018 the following dates will be valid", + "list": [ + "Yesterday 30/03/2018", + "Today 31/03/2018", + "Tomorrow 01/04/2018", + "Last Month 28/02/2018 (28th as no 31st February)", + "Next Month 30/04/2018 (30th as no 31st April)", + "Last Year 31/03/2017", + "Next Year 31/03/2019" + ] + } + ] + } + } + }, + { + "type": "Question", + "id": "date-question", + "question": { + "answers": [ + { + "id": "single-date-answer", + "label": "Today", + "mandatory": true, + "type": "Date" + } + ], + "id": "date-questions", + "title": { + "text": "Enter {date} or offset by one day, month or year in either direction", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "answers", + "identifier": "comparison-date-answer" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + "or": [ + { + "==": [ + { + "date": [ + { + "source": "answers", + "identifier": "single-date-answer" + } + ] + }, + { + "date": [ + { + "source": "answers", + "identifier": "comparison-date-answer" + }, + { + "days": -1 + } + ] + } + ] + }, + { + "==": [ + { + "date": [ + { + "source": "answers", + "identifier": "single-date-answer" + } + ] + }, + { + "date": [ + { + "source": "answers", + "identifier": "comparison-date-answer" + } + ] + } + ] + }, + { + "==": [ + { + "date": [ + { + "source": "answers", + "identifier": "single-date-answer" + } + ] + }, + { + "date": [ + { + "source": "answers", + "identifier": "comparison-date-answer" + }, + { + "days": 1 + } + ] + } + ] + }, + { + "==": [ + { + "date": [ + { + "source": "answers", + "identifier": "single-date-answer" + } + ] + }, + { + "date": [ + { + "source": "answers", + "identifier": "comparison-date-answer" + }, + { + "months": -1 + } + ] + } + ] + }, + { + "==": [ + { + "date": [ + { + "source": "answers", + "identifier": "single-date-answer" + } + ] + }, + { + "date": [ + { + "source": "answers", + "identifier": "comparison-date-answer" + }, + { + "months": 1 + } + ] + } + ] + }, + { + "==": [ + { + "date": [ + { + "source": "answers", + "identifier": "single-date-answer" + } + ] + }, + { + "date": [ + { + "source": "answers", + "identifier": "comparison-date-answer" + }, + { + "years": -1 + } + ] + } + ] + }, + { + "==": [ + { + "date": [ + { + "source": "answers", + "identifier": "single-date-answer" + } + ] + }, + { + "date": [ + { + "source": "answers", + "identifier": "comparison-date-answer" + }, + { + "years": 1 + } + ] + } + ] + } + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "Incorrect Date", + "contents": [ + { + "description": "You entered an incorrect date" + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "Correct Date", + "contents": [ + { + "description": "You entered a correct date." + } + ] + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_date_greater_than.json b/schemas/test/en/test_routing_date_greater_than.json new file mode 100644 index 0000000000..cecc09776f --- /dev/null +++ b/schemas/test/en/test_routing_date_greater_than.json @@ -0,0 +1,168 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Date Greater Than", + "theme": "default", + "description": "A test survey for routing based on a date greater than", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "return_by", + "type": "date" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "date-question", + "question": { + "answers": [ + { + "id": "single-date-answer", + "mandatory": true, + "type": "Date" + } + ], + "id": "date-questions", + "title": { + "text": "Enter a date greater than Return date: {date}", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "return_by" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + }, + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + ">": [ + { + "date": [{ "source": "answers", "identifier": "single-date-answer" }] + }, + { + "date": [{ "source": "metadata", "identifier": "return_by" }] + } + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "Incorrect answer", + "contents": [ + { + "description": { + "text": "You entered a return date earlier than {date}", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "return_by" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + } + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "Correct answer", + "contents": [ + { + "description": { + "text": "You entered a return date later than {date}", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "return_by" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + } + } + ] + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_date_greater_than_or_equals.json b/schemas/test/en/test_routing_date_greater_than_or_equals.json new file mode 100644 index 0000000000..aff5d6d350 --- /dev/null +++ b/schemas/test/en/test_routing_date_greater_than_or_equals.json @@ -0,0 +1,149 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Date Greater Than Or Equals", + "theme": "default", + "description": "A test survey for routing based on a date greater than or equals", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "return_by", + "type": "date" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "date-question", + "question": { + "answers": [ + { + "id": "single-date-answer", + "mandatory": true, + "type": "YearDate" + } + ], + "id": "date-questions", + "title": "Enter a year greater than or equals to 2018", + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + ">=": [ + { + "date": [{ "source": "answers", "identifier": "single-date-answer" }] + }, + { + "date": ["2018"] + } + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "Incorrect answer", + "contents": [ + { + "description": { + "text": "You entered a return date earlier than {date}", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "return_by" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + } + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "Correct answer", + "contents": [ + { + "description": { + "text": "You entered a return date later than {date}", + "placeholders": [ + { + "placeholder": "date", + "transforms": [ + { + "transform": "format_date", + "arguments": { + "date_to_format": { + "source": "metadata", + "identifier": "return_by" + }, + "date_format": "d MMMM yyyy" + } + } + ] + } + ] + } + } + ] + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_date_less_than.json b/schemas/test/en/test_routing_date_less_than.json new file mode 100644 index 0000000000..30925081ff --- /dev/null +++ b/schemas/test/en/test_routing_date_less_than.json @@ -0,0 +1,108 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Date Less Than", + "theme": "default", + "description": "A test survey for routing based on a Date less than", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "date-question", + "question": { + "answers": [ + { + "id": "single-date-answer", + "label": "Today", + "mandatory": true, + "type": "Date" + } + ], + "id": "date-questions", + "title": "Enter a date less than Today", + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + "<": [ + { + "date": [{ "source": "answers", "identifier": "single-date-answer" }] + }, + { + "date": ["now"] + } + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "Incorrect answer", + "contents": [ + { + "description": "You entered a date later than yesterday." + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "Correct answer", + "contents": [ + { + "description": "You entered a date older than Today." + } + ] + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_date_less_than_or_equals.json b/schemas/test/en/test_routing_date_less_than_or_equals.json new file mode 100644 index 0000000000..1e703687d2 --- /dev/null +++ b/schemas/test/en/test_routing_date_less_than_or_equals.json @@ -0,0 +1,108 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Date Less Than Or Equals", + "theme": "default", + "description": "A test survey for routing based on a Date less than or equals", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "date-question", + "question": { + "answers": [ + { + "id": "single-date-answer", + "label": "Today", + "mandatory": true, + "type": "Date" + } + ], + "id": "date-questions", + "title": "Enter a date less than or equals Today", + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + "<=": [ + { + "date": [{ "source": "answers", "identifier": "single-date-answer" }] + }, + { + "date": ["now"] + } + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "Incorrect answer", + "contents": [ + { + "description": "You entered a date later than yesterday." + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "Correct answer", + "contents": [ + { + "description": "You entered a date older than Today." + } + ] + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_date_not_equals.json b/schemas/test/en/test_routing_date_not_equals.json new file mode 100644 index 0000000000..0cbb7d5ee8 --- /dev/null +++ b/schemas/test/en/test_routing_date_not_equals.json @@ -0,0 +1,108 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Date Not Equals", + "theme": "default", + "description": "A test survey for routing based on a date not equals", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "date-question", + "question": { + "answers": [ + { + "id": "single-date-answer", + "label": "Today", + "mandatory": true, + "type": "MonthYearDate" + } + ], + "id": "date-questions", + "title": "Enter a date other than February 2018", + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + "!=": [ + { + "date": [{ "source": "answers", "identifier": "single-date-answer" }] + }, + { + "date": ["2018-02"] + } + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "Incorrect Date", + "contents": [ + { + "description": "You entered 28 February 2018." + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "Correct Date", + "contents": [ + { + "description": "You entered a date other than 28 February 2018." + } + ] + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_group.json b/schemas/test/en/test_routing_group.json new file mode 100644 index 0000000000..1370f2f529 --- /dev/null +++ b/schemas/test/en/test_routing_group.json @@ -0,0 +1,137 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Routing Group", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "which-group", + "title": "What group do you want to go to?", + "blocks": [ + { + "type": "Question", + "id": "which-group-block", + "question": { + "id": "which-group-question", + "title": "Select Group", + "type": "General", + "answers": [ + { + "id": "which-group-answer", + "label": "Choose next group", + "mandatory": true, + "options": [ + { + "label": "Group 1", + "value": "Group 1" + }, + { + "label": "Group 2", + "value": "Group 2" + } + ], + "type": "Radio", + "validation": { + "messages": {} + } + } + ] + }, + "routing_rules": [ + { + "group": "group1", + "when": { + "==": [ + { + "identifier": "which-group-answer", + "source": "answers" + }, + "Group 1" + ] + } + }, + { + "group": "group2" + } + ] + } + ] + }, + { + "id": "group1", + "title": "This is Group 1", + "blocks": [ + { + "type": "Question", + "id": "group1-block", + "question": { + "id": "group1-question", + "title": "Did you want Group 1?", + "type": "General", + "answers": [ + { + "id": "group1-answer", + "label": "Why did you choose Group 1?", + "mandatory": true, + "type": "TextArea" + } + ] + } + } + ] + }, + { + "id": "group2", + "title": "This is Group 2", + "blocks": [ + { + "type": "Question", + "id": "group2-block", + "question": { + "id": "group2-question", + "title": "Did you want Group 2?", + "type": "General", + "answers": [ + { + "id": "group2-answer", + "label": "Why did you choose Group 2?", + "mandatory": true, + "type": "TextArea" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_not.json b/schemas/test/en/test_routing_not.json new file mode 100644 index 0000000000..76327eeb07 --- /dev/null +++ b/schemas/test/en/test_routing_not.json @@ -0,0 +1,124 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Not", + "theme": "default", + "description": "A test survey for routing based on the NOT operator", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "country-checkbox", + "question": { + "id": "country-checkbox-question", + "title": "Have you visited any of the following countries?", + "type": "General", + "answers": [ + { + "id": "country-checkbox-answer", + "mandatory": false, + "type": "Checkbox", + "instruction": "Do not select India", + "options": [ + { + "label": "India", + "value": "India" + }, + { + "label": "Azerbaijan", + "value": "Azerbaijan" + }, + { + "label": "Liechtenstein", + "value": "Liechtenstein" + }, + { + "label": "Malta", + "value": "Malta" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "country-interstitial-not-india", + "when": { + "not": [ + { + "in": [ + "India", + { + "source": "answers", + "identifier": "country-checkbox-answer" + } + ] + } + ] + } + }, + { + "block": "country-interstitial-india" + } + ] + }, + { + "id": "country-interstitial-not-india", + "type": "Interstitial", + "content": { + "title": "Condition: Does not contain India", + "contents": [ + { + "description": "You did not chose India." + } + ] + } + }, + { + "id": "country-interstitial-india", + "type": "Interstitial", + "content": { + "title": "Condition: Contained India", + "contents": [ + { + "description": "You chose India." + } + ] + } + } + ], + "id": "checkboxes" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_not_affected_by_answers_not_on_path.json b/schemas/test/en/test_routing_not_affected_by_answers_not_on_path.json new file mode 100644 index 0000000000..7332f007ab --- /dev/null +++ b/schemas/test/en/test_routing_not_affected_by_answers_not_on_path.json @@ -0,0 +1,197 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test routing not affected by invalid answers", + "theme": "default", + "description": "A test survey to make sure previous answers that are not on the routing path do not affect routing", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "initial-choice", + "question": { + "type": "General", + "id": "initial-choice-question", + "title": "Answer First, then, after answering a question, go back to this question and answer Second", + "answers": [ + { + "type": "Radio", + "id": "initial-choice-answer", + "mandatory": true, + "options": [ + { + "label": "Go here first", + "value": "Go here first" + }, + { + "label": "Go here second", + "value": "Go here second" + } + ] + } + ] + }, + "routing_rules": [ + { + "block": "valid-path", + "when": { + "==": [ + { + "identifier": "initial-choice-answer", + "source": "answers" + }, + "Go here second" + ] + } + }, + { + "block": "invalid-path" + } + ] + }, + { + "type": "Question", + "id": "invalid-path", + "question": { + "answers": [ + { + "id": "invalid-path-answer", + "mandatory": true, + "label": "Number", + "type": "Number" + } + ], + "id": "invalid-path-question", + "title": "Enter a number", + "type": "General" + } + }, + { + "type": "Interstitial", + "id": "invalid-path-interstitial", + "content": { + "title": "You now have an answer that could be invalid in the store.", + "contents": [ + { + "description": "Go back to the first question and choose the second path." + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Question", + "id": "valid-path", + "question": { + "answers": [ + { + "id": "valid-path-answer", + "mandatory": true, + "type": "Number", + "label": "Number" + } + ], + "id": "valid-path-question", + "title": "Enter a number and continue", + "type": "General" + }, + "routing_rules": [ + { + "block": "invalid-final-interstitial", + "when": { + "!=": [ + { + "identifier": "invalid-path-answer", + "source": "answers" + }, + null + ] + } + }, + { + "block": "valid-skipped-interstitial" + } + ] + }, + { + "type": "Interstitial", + "id": "valid-skipped-interstitial", + "content": { + "title": "This page should have been skipped!" + }, + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "invalid-path-answer", + "source": "answers" + }, + null + ] + } + } + }, + { + "type": "Interstitial", + "id": "valid-final-interstitial", + "content": { + "title": "You were routed correctly!" + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "invalid-final-interstitial", + "content": { + "title": "You were routed incorrectly!" + }, + "routing_rules": [ + { + "section": "End" + } + ] + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_number_equals.json b/schemas/test/en/test_routing_number_equals.json new file mode 100644 index 0000000000..83c33bf109 --- /dev/null +++ b/schemas/test/en/test_routing_number_equals.json @@ -0,0 +1,129 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Number Equals", + "theme": "default", + "description": "A test survey for routing based on a number equals", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "number-question", + "question": { + "answers": [ + { + "id": "answer", + "mandatory": true, + "type": "Number", + "label": "Enter 123" + } + ], + "id": "question", + "title": "Enter the number 123", + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + "==": [ + { + "source": "answers", + "identifier": "answer" + }, + 123 + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "You did not enter 123", + "contents": [ + { + "description": { + "text": "You were asked to enter 123 but you actually entered {answer}.", + "placeholders": [ + { + "placeholder": "answer", + "value": { + "source": "answers", + "identifier": "answer" + } + } + ] + } + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "Correct", + "contents": [ + { + "description": { + "text": "You were asked to enter 123 and you entered {answer}.", + "placeholders": [ + { + "placeholder": "answer", + "value": { + "source": "answers", + "identifier": "answer" + } + } + ] + } + } + ] + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_number_greater_than.json b/schemas/test/en/test_routing_number_greater_than.json new file mode 100644 index 0000000000..1e5f8552b5 --- /dev/null +++ b/schemas/test/en/test_routing_number_greater_than.json @@ -0,0 +1,129 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Number Greater Than", + "theme": "default", + "description": "A test survey for routing based on a number greater than", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "number-question", + "question": { + "answers": [ + { + "id": "answer", + "mandatory": true, + "type": "Number", + "label": "Enter a number greater than 123" + } + ], + "id": "question", + "title": "Enter a number greater than 123", + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + ">": [ + { + "source": "answers", + "identifier": "answer" + }, + 123 + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "You did not enter a number greater than 123", + "contents": [ + { + "description": { + "text": "You were asked to enter a number greater than 123 but you actually entered {answer}.", + "placeholders": [ + { + "placeholder": "answer", + "value": { + "source": "answers", + "identifier": "answer" + } + } + ] + } + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "Correct", + "contents": [ + { + "description": { + "text": "You were asked to enter a number greater than 123 and you entered {answer}.", + "placeholders": [ + { + "placeholder": "answer", + "value": { + "source": "answers", + "identifier": "answer" + } + } + ] + } + } + ] + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_number_greater_than_or_equal.json b/schemas/test/en/test_routing_number_greater_than_or_equal.json new file mode 100644 index 0000000000..b0096acdf8 --- /dev/null +++ b/schemas/test/en/test_routing_number_greater_than_or_equal.json @@ -0,0 +1,129 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Number Greater Than Or Equal To", + "theme": "default", + "description": "A test survey for routing based on a number greater than or equal to", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "number-question", + "question": { + "answers": [ + { + "id": "answer", + "mandatory": true, + "type": "Number", + "label": "123 or greater" + } + ], + "id": "question", + "title": "Enter the number greater than or equal to 123", + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + ">=": [ + { + "source": "answers", + "identifier": "answer" + }, + 123 + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "Incorrect answer", + "contents": [ + { + "description": { + "text": "You were asked to enter a number greater than or equal to 123 but you entered {answer}.", + "placeholders": [ + { + "placeholder": "answer", + "value": { + "source": "answers", + "identifier": "answer" + } + } + ] + } + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "Correct answer", + "contents": [ + { + "description": { + "text": "You were asked to enter a number greater than or equal to 123 and you entered {answer}.", + "placeholders": [ + { + "placeholder": "answer", + "value": { + "source": "answers", + "identifier": "answer" + } + } + ] + } + } + ] + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_number_greater_than_or_equal_single_condition.json b/schemas/test/en/test_routing_number_greater_than_or_equal_single_condition.json new file mode 100644 index 0000000000..b16a50963d --- /dev/null +++ b/schemas/test/en/test_routing_number_greater_than_or_equal_single_condition.json @@ -0,0 +1,129 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Number Greater Than or Equal", + "theme": "default", + "description": "A test survey for routing based on a number greater than or equal", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "number-question", + "question": { + "answers": [ + { + "id": "answer", + "mandatory": true, + "type": "Number", + "label": "123 or greater" + } + ], + "id": "question", + "title": "Enter the number greater than or equal to 123", + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + ">=": [ + { + "source": "answers", + "identifier": "answer" + }, + 123 + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "Incorrect answer", + "contents": [ + { + "description": { + "text": "You were asked to enter a number greater than or equal to 123 but you entered {answer}.", + "placeholders": [ + { + "placeholder": "answer", + "value": { + "source": "answers", + "identifier": "answer" + } + } + ] + } + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "Correct answer", + "contents": [ + { + "description": { + "text": "You were asked to enter a number greater than or equal to 123 and you entered {answer}.", + "placeholders": [ + { + "placeholder": "answer", + "value": { + "source": "answers", + "identifier": "answer" + } + } + ] + } + } + ] + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_number_less_than.json b/schemas/test/en/test_routing_number_less_than.json new file mode 100644 index 0000000000..ed5eec019f --- /dev/null +++ b/schemas/test/en/test_routing_number_less_than.json @@ -0,0 +1,129 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Number Less Than", + "theme": "default", + "description": "A test survey for routing based on a number less than", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "number-question", + "question": { + "answers": [ + { + "id": "answer", + "mandatory": true, + "type": "Number", + "label": "Enter a number less than 123" + } + ], + "id": "question", + "title": "Enter a number less than 123", + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + "<": [ + { + "source": "answers", + "identifier": "answer" + }, + 123 + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "You did not enter a number less than 123", + "contents": [ + { + "description": { + "text": "You were asked to enter a number less than 123 but you actually entered {answer}.", + "placeholders": [ + { + "placeholder": "answer", + "value": { + "source": "answers", + "identifier": "answer" + } + } + ] + } + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "Correct", + "contents": [ + { + "description": { + "text": "You were asked to enter a number less than 123 and you entered {answer}.", + "placeholders": [ + { + "placeholder": "answer", + "value": { + "source": "answers", + "identifier": "answer" + } + } + ] + } + } + ] + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_number_less_than_or_equal.json b/schemas/test/en/test_routing_number_less_than_or_equal.json new file mode 100644 index 0000000000..d45041fd8a --- /dev/null +++ b/schemas/test/en/test_routing_number_less_than_or_equal.json @@ -0,0 +1,129 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Number Less Than Or Equal To", + "theme": "default", + "description": "A test survey for routing based on a number less than or equal to", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "number-question", + "question": { + "answers": [ + { + "id": "answer", + "mandatory": true, + "type": "Number", + "label": "Number" + } + ], + "id": "question", + "title": "Enter the number less than or equal to 123", + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + "<=": [ + { + "source": "answers", + "identifier": "answer" + }, + 123 + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "Incorrect answer", + "contents": [ + { + "description": { + "text": "You were asked to enter a number less than or equal to 123 but you entered {answer}.", + "placeholders": [ + { + "placeholder": "answer", + "value": { + "source": "answers", + "identifier": "answer" + } + } + ] + } + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "Correct answer", + "contents": [ + { + "description": { + "text": "You were asked to enter a number less than or equal to 123 and you entered {answer}.", + "placeholders": [ + { + "placeholder": "answer", + "value": { + "source": "answers", + "identifier": "answer" + } + } + ] + } + } + ] + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_number_less_than_or_equal_single_condition.json b/schemas/test/en/test_routing_number_less_than_or_equal_single_condition.json new file mode 100644 index 0000000000..ef8ba8b256 --- /dev/null +++ b/schemas/test/en/test_routing_number_less_than_or_equal_single_condition.json @@ -0,0 +1,129 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Number less Than or Equal", + "theme": "default", + "description": "A test survey for routing based on a number less than or equal", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "number-question", + "question": { + "answers": [ + { + "id": "answer", + "mandatory": true, + "type": "Number", + "label": "Number" + } + ], + "id": "question", + "title": "Enter the number less than or equal to 123", + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + "<=": [ + { + "source": "answers", + "identifier": "answer" + }, + 123 + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "Incorrect answer", + "contents": [ + { + "description": { + "text": "You were asked to enter a number less than or equal to 123 but you entered {answer}.", + "placeholders": [ + { + "placeholder": "answer", + "value": { + "source": "answers", + "identifier": "answer" + } + } + ] + } + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "Correct answer", + "contents": [ + { + "description": { + "text": "You were asked to enter a number less than or equal to 123 and you entered {answer}.", + "placeholders": [ + { + "placeholder": "answer", + "value": { + "source": "answers", + "identifier": "answer" + } + } + ] + } + } + ] + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_number_not_equals.json b/schemas/test/en/test_routing_number_not_equals.json new file mode 100644 index 0000000000..e0c7505133 --- /dev/null +++ b/schemas/test/en/test_routing_number_not_equals.json @@ -0,0 +1,129 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Number Not Equals", + "theme": "default", + "description": "A test survey for routing based on a number not equals", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "number-question", + "question": { + "answers": [ + { + "id": "answer", + "mandatory": true, + "type": "Number", + "label": "Not 123" + } + ], + "id": "question", + "title": "Enter the number that isn’t 123", + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + "!=": [ + { + "source": "answers", + "identifier": "answer" + }, + 123 + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "Incorrect answer", + "contents": [ + { + "description": { + "text": "You were asked not to enter 123 but you entered {answer}.", + "placeholders": [ + { + "placeholder": "answer", + "value": { + "source": "answers", + "identifier": "answer" + } + } + ] + } + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "Correct answer", + "contents": [ + { + "description": { + "text": "You were asked not to enter 123 and you entered {answer}.", + "placeholders": [ + { + "placeholder": "answer", + "value": { + "source": "answers", + "identifier": "answer" + } + } + ] + } + } + ] + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_on_multiple_select.json b/schemas/test/en/test_routing_on_multiple_select.json new file mode 100644 index 0000000000..312b654f2d --- /dev/null +++ b/schemas/test/en/test_routing_on_multiple_select.json @@ -0,0 +1,126 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test schema for routing on multiple selected answers", + "description": "Test schema for routing on multiple selected answers", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "group1", + "title": "Group 1", + "blocks": [ + { + "type": "Question", + "id": "block1", + "question": { + "id": "block1-question", + "title": "Question 1", + "type": "General", + "answers": [ + { + "id": "passports-answer", + "mandatory": false, + "options": [ + { + "label": "United Kingdom", + "value": "United Kingdom" + }, + { + "label": "Irish", + "value": "Irish" + }, + { + "label": "None", + "value": "None" + } + ], + "type": "Checkbox" + } + ] + }, + "routing_rules": [ + { + "block": "block3", + "when": { + "in": [ + "United Kingdom", + { + "identifier": "passports-answer", + "source": "answers" + } + ] + } + }, + { + "block": "block2" + } + ] + }, + { + "type": "Question", + "id": "block2", + "question": { + "id": "block2-question", + "title": "Question 2", + "type": "General", + "answers": [ + { + "id": "block2-answer", + "label": "Question 2", + "mandatory": false, + "type": "TextField" + } + ] + } + }, + { + "type": "Question", + "id": "block3", + "question": { + "id": "block3-question", + "title": "Question 3", + "type": "General", + "answers": [ + { + "id": "block3-answer", + "label": "Question 3", + "mandatory": false, + "type": "TextField" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_or.json b/schemas/test/en/test_routing_or.json new file mode 100644 index 0000000000..0b888a557c --- /dev/null +++ b/schemas/test/en/test_routing_or.json @@ -0,0 +1,180 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Or", + "theme": "default", + "description": "A test survey for routing based on the OR operator", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "number-question-1", + "question": { + "guidance": { + "contents": [ + { + "description": "Enter 123 here OR 321 on the next question to route to the “correct” page otherwise you will be routed to the “incorrect” page" + } + ] + }, + "answers": [ + { + "id": "answer-1", + "mandatory": true, + "type": "Number", + "label": "Enter 123" + } + ], + "id": "question-1", + "title": "Enter the number 123", + "type": "General" + } + }, + { + "type": "Question", + "id": "number-question-2", + "question": { + "answers": [ + { + "id": "answer-2", + "mandatory": true, + "type": "Number", + "label": "Enter 321" + } + ], + "id": "question-2", + "title": "Enter the number 321", + "type": "General" + }, + "routing_rules": [ + { + "block": "correct-answer", + "when": { + "or": [ + { + "==": [ + { + "source": "answers", + "identifier": "answer-1" + }, + 123 + ] + }, + { + "==": [ + { + "source": "answers", + "identifier": "answer-2" + }, + 321 + ] + } + ] + } + }, + { + "block": "incorrect-answer" + } + ] + }, + { + "type": "Interstitial", + "id": "incorrect-answer", + "content": { + "title": "You did not enter a correct answer", + "contents": [ + { + "description": { + "text": "You were asked to enter 123 or 321 but you actually entered {answer_1} and {answer_2}.", + "placeholders": [ + { + "placeholder": "answer_1", + "value": { + "source": "answers", + "identifier": "answer-1" + } + }, + { + "placeholder": "answer_2", + "value": { + "source": "answers", + "identifier": "answer-2" + } + } + ] + } + } + ] + }, + "routing_rules": [ + { + "section": "End" + } + ] + }, + { + "type": "Interstitial", + "id": "correct-answer", + "content": { + "title": "Correct", + "contents": [ + { + "description": { + "text": "You were asked to enter 123 or 321 and you entered {answer_1} and {answer_2}.", + "placeholders": [ + { + "placeholder": "answer_1", + "value": { + "source": "answers", + "identifier": "answer-1" + } + }, + { + "placeholder": "answer_2", + "value": { + "source": "answers", + "identifier": "answer-2" + } + } + ] + } + } + ] + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_to_questionnaire_end_multiple_sections.json b/schemas/test/en/test_routing_to_questionnaire_end_multiple_sections.json new file mode 100644 index 0000000000..18f1fe51a5 --- /dev/null +++ b/schemas/test/en/test_routing_to_questionnaire_end_multiple_sections.json @@ -0,0 +1,152 @@ +{ + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "137", + "theme": "default", + "title": "Test Routing To Questionnaire End (Multiple Sections)", + "mime_type": "application/json/ons/eq", + "navigation": { + "visible": true + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "test-section", + "title": "Section 1", + "groups": [ + { + "blocks": [ + { + "id": "test-forced", + "question": { + "title": "Would you like to complete section 2?", + "answers": [ + { + "id": "test-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "test-question", + "type": "General" + }, + "type": "Question", + "routing_rules": [ + { + "when": { + "==": [ + { + "source": "answers", + "identifier": "test-answer" + }, + "No" + ] + }, + "section": "End" + }, + { + "group": "test-group-2", + "when": { + "==": [ + { + "source": "answers", + "identifier": "test-answer" + }, + "Yes" + ] + } + }, + { + "section": "End" + } + ] + } + ], + "id": "test-group", + "title": "Section 1" + } + ] + }, + { + "id": "test-section-2", + "title": "Section 2", + "enabled": { + "when": { + "==": [ + "Yes", + { + "source": "answers", + "identifier": "test-answer" + } + ] + } + }, + "groups": [ + { + "blocks": [ + { + "id": "test-optional", + "type": "Question", + "question": { + "answers": [ + { + "id": "test-optional-answer", + "mandatory": true, + "options": [ + { + "label": "I am a completionist", + "value": "I am a completionist" + }, + { + "label": "Other", + "value": "Other" + } + ], + "type": "Radio" + } + ], + "id": "test-optional-question", + "title": "Why did you choose to complete this section?", + "type": "General" + } + } + ], + "id": "test-group-2", + "title": "Section 2" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_to_questionnaire_end_single_section.json b/schemas/test/en/test_routing_to_questionnaire_end_single_section.json new file mode 100644 index 0000000000..ea17355008 --- /dev/null +++ b/schemas/test/en/test_routing_to_questionnaire_end_single_section.json @@ -0,0 +1,135 @@ +{ + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "137", + "theme": "default", + "title": "Test Routing To Questionnaire End (Single Section)", + "mime_type": "application/json/ons/eq", + "navigation": { + "visible": true + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "test-section", + "title": "Section 1", + "groups": [ + { + "blocks": [ + { + "id": "test-forced", + "question": { + "title": "Would you like to complete question 2?", + "answers": [ + { + "id": "test-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "test-question", + "type": "General" + }, + "type": "Question", + "routing_rules": [ + { + "when": { + "==": [ + { + "source": "answers", + "identifier": "test-answer" + }, + "No" + ] + }, + "section": "End" + }, + { + "group": "test-group-2", + "when": { + "==": [ + { + "source": "answers", + "identifier": "test-answer" + }, + "Yes" + ] + } + }, + { + "section": "End" + } + ] + } + ], + "id": "test-group", + "title": "Group 1" + }, + { + "blocks": [ + { + "id": "test-optional", + "type": "Question", + "question": { + "answers": [ + { + "id": "test-optional-answer", + "mandatory": true, + "options": [ + { + "label": "I am a completionist", + "value": "I am a completionist" + }, + { + "label": "Other", + "value": "Other" + } + ], + "type": "Radio" + } + ], + "id": "test-optional-question", + "title": "Why did you choose to complete this question?", + "type": "General" + } + } + ], + "id": "test-group-2", + "title": "Group 2" + } + ] + } + ] +} diff --git a/schemas/test/en/test_routing_to_section_end.json b/schemas/test/en/test_routing_to_section_end.json new file mode 100644 index 0000000000..a27707979b --- /dev/null +++ b/schemas/test/en/test_routing_to_section_end.json @@ -0,0 +1,204 @@ +{ + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "137", + "theme": "default", + "title": "Test Routing To Section End", + "mime_type": "application/json/ons/eq", + "navigation": { + "visible": true + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "test-section", + "title": "Section 1", + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "blocks": [ + { + "id": "test-forced", + "question": { + "title": "Were you forced to complete section 1?", + "answers": [ + { + "id": "test-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "test-question", + "type": "General" + }, + "type": "Question", + "routing_rules": [ + { + "block": "test-optional", + "when": { + "==": [ + { + "identifier": "test-answer", + "source": "answers" + }, + "Yes" + ] + } + }, + { + "section": "End" + } + ] + }, + { + "id": "test-optional", + "type": "Question", + "question": { + "answers": [ + { + "id": "test-optional-answer", + "mandatory": true, + "options": [ + { + "label": "£5 Cash", + "value": "£5 Cash" + }, + { + "label": "£10 Amazon Voucher", + "value": "£10 Amazon Voucher" + } + ], + "type": "Checkbox" + } + ], + "id": "test-optional-question", + "title": "What would incentivise you to complete this section?", + "type": "General" + } + } + ], + "id": "test-group", + "title": "Section 1" + } + ] + }, + { + "id": "test-section-2", + "title": "Section 2", + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "blocks": [ + { + "id": "test-forced-2", + "question": { + "answers": [ + { + "id": "test-answer-2", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "test-question-2", + "title": "Were you forced to complete section 2?", + "type": "General" + }, + "type": "Question", + "routing_rules": [ + { + "block": "test-optional-2", + "when": { + "==": [ + { + "identifier": "test-answer-2", + "source": "answers" + }, + "Yes" + ] + } + }, + { + "section": "End" + } + ] + }, + { + "id": "test-optional-2", + "type": "Question", + "question": { + "answers": [ + { + "id": "test-optional-answer-2", + "mandatory": true, + "options": [ + { + "label": "£5 Cash", + "value": "£5 Cash" + }, + { + "label": "£10 Amazon Voucher", + "value": "£10 Amazon Voucher" + } + ], + "type": "Checkbox" + } + ], + "id": "test-optional-question-2", + "title": "What would incentivise you to complete this section?", + "type": "General" + } + } + ], + "id": "test-group-2", + "title": "Section 2" + } + ] + } + ] +} diff --git a/schemas/test/en/test_section_enabled_checkbox.json b/schemas/test/en/test_section_enabled_checkbox.json new file mode 100644 index 0000000000..7c60b826c5 --- /dev/null +++ b/schemas/test/en/test_section_enabled_checkbox.json @@ -0,0 +1,168 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Section Enabled", + "theme": "default", + "description": "A questionnaire to demo section enabled key usage with checkbox options", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section-1", + "title": "Section 1", + "groups": [ + { + "blocks": [ + { + "id": "section-1-block", + "type": "Question", + "question": { + "answers": [ + { + "id": "section-1-answer", + "label": "label 1", + "mandatory": false, + "options": [ + { + "label": "Section 2", + "value": "Section 2" + }, + { + "label": "Section 3", + "value": "Section 3" + } + ], + "type": "Checkbox" + }, + { + "id": "section-1-answer-exclusive", + "mandatory": false, + "options": [ + { + "label": "Neither", + "value": "Neither" + } + ], + "type": "Checkbox" + } + ], + "mandatory": false, + "description": ["This is section 1."], + "id": "section-1-question", + "title": "Which sections do you want to enable?", + "type": "MutuallyExclusive" + } + } + ], + "id": "section-1-group", + "title": "Section 1" + } + ] + }, + { + "id": "section-2", + "title": "Section 2", + "enabled": { + "when": { + "in": [ + "Section 2", + { + "source": "answers", + "identifier": "section-1-answer" + } + ] + } + }, + "groups": [ + { + "blocks": [ + { + "id": "section-2-block", + "type": "Question", + "question": { + "answers": [ + { + "id": "section-2-answer", + "label": "label 2", + "mandatory": false, + "type": "Number" + } + ], + "description": ["This is section 2."], + "id": "section-2-question", + "title": "Which section is this?", + "type": "General" + } + } + ], + "id": "section-2-group", + "title": "Section 2" + } + ] + }, + { + "id": "section-3", + "title": "Section 3", + "enabled": { + "when": { + "in": [ + "Section 3", + { + "source": "answers", + "identifier": "section-1-answer" + } + ] + } + }, + "groups": [ + { + "blocks": [ + { + "id": "section-3-block", + "type": "Question", + "question": { + "answers": [ + { + "id": "section-3-answer", + "label": "label 3", + "mandatory": false, + "type": "Number" + } + ], + "description": ["This is section 3."], + "id": "section-3-question", + "title": "Which section is this?", + "type": "General" + } + } + ], + "id": "section-3-group", + "title": "Section 3" + } + ] + } + ] +} diff --git a/schemas/test/en/test_section_enabled_hub.json b/schemas/test/en/test_section_enabled_hub.json new file mode 100644 index 0000000000..5f6e82f73b --- /dev/null +++ b/schemas/test/en/test_section_enabled_hub.json @@ -0,0 +1,163 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Section Enabled", + "theme": "default", + "description": "A questionnaire to demo section enabled key usage with hub enabled", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { "required_completed_sections": ["section-1"] } + }, + "sections": [ + { + "id": "section-1", + "title": "Section 1", + "groups": [ + { + "blocks": [ + { + "id": "section-1-block", + "type": "Question", + "question": { + "answers": [ + { + "id": "section-1-answer", + "mandatory": false, + "options": [ + { + "label": "Section 2", + "value": "Section 2" + }, + { + "label": "Section 3", + "value": "Section 3" + } + ], + "type": "Checkbox" + }, + { + "id": "section-1-answer-exclusive", + "mandatory": false, + "options": [ + { + "label": "Neither", + "value": "Neither" + } + ], + "type": "Checkbox" + } + ], + "mandatory": false, + "description": ["This is section 1."], + "id": "section-1-question", + "title": "Which sections do you want to enable?", + "type": "MutuallyExclusive" + } + } + ], + "id": "section-1-group", + "title": "Section 1" + } + ] + }, + { + "id": "section-2", + "title": "Section 2", + "enabled": { + "when": { + "in": [ + "Section 2", + { + "source": "answers", + "identifier": "section-1-answer" + } + ] + } + }, + "groups": [ + { + "blocks": [ + { + "id": "section-2-block", + "type": "Question", + "question": { + "answers": [ + { + "id": "section-2-answer", + "label": "Section 2", + "mandatory": false, + "type": "Number" + } + ], + "description": ["This is section 2."], + "id": "section-2-question", + "title": "Which section is this?", + "type": "General" + } + } + ], + "id": "section-2-group", + "title": "Section 2" + } + ] + }, + { + "id": "section-3", + "title": "Section 3", + "enabled": { + "when": { + "in": [ + "Section 3", + { + "source": "answers", + "identifier": "section-1-answer" + } + ] + } + }, + "groups": [ + { + "blocks": [ + { + "id": "section-3-block", + "type": "Question", + "question": { + "answers": [ + { + "id": "section-3-answer", + "label": "Section 3", + "mandatory": false, + "type": "Number" + } + ], + "description": ["This is section 3."], + "id": "section-3-question", + "title": "Which section is this?", + "type": "General" + } + } + ], + "id": "section-3-group", + "title": "Section 3" + } + ] + } + ] +} diff --git a/schemas/test/en/test_section_enabled_radio.json b/schemas/test/en/test_section_enabled_radio.json new file mode 100644 index 0000000000..3141ae569f --- /dev/null +++ b/schemas/test/en/test_section_enabled_radio.json @@ -0,0 +1,115 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Section Enabled", + "theme": "default", + "description": "A questionnaire to demo section enabled key usage with radio options", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section-1", + "title": "Section 1", + "groups": [ + { + "blocks": [ + { + "id": "section-1-block", + "type": "Question", + "question": { + "answers": [ + { + "id": "section-1-answer", + "label": "Section 1", + "mandatory": false, + "options": [ + { + "label": "Yes, enable section 2", + "value": "Yes, enable section 2" + }, + { + "label": "No, disable section 2", + "value": "No, disable section 2" + } + ], + "type": "Radio" + } + ], + "description": ["This is section 1."], + "id": "section-1-question", + "title": "Do you want to enable section 2?", + "type": "General" + } + } + ], + "id": "section-1-group", + "title": "Section 1" + } + ] + }, + { + "id": "section-2", + "title": "Section 2", + "enabled": { + "when": { + "==": [ + "Yes, enable section 2", + { + "source": "answers", + "identifier": "section-1-answer" + } + ] + } + }, + "groups": [ + { + "blocks": [ + { + "id": "section-2-block", + "type": "Question", + "question": { + "answers": [ + { + "id": "section-2-answer", + "label": "Section 2", + "mandatory": false, + "type": "Number" + } + ], + "description": ["This is section 2."], + "id": "section-2-question", + "title": "Which section is this?", + "type": "General" + } + } + ], + "id": "section-2-group", + "title": "Section 2" + } + ] + } + ] +} diff --git a/schemas/test/en/test_section_summary.json b/schemas/test/en/test_section_summary.json new file mode 100644 index 0000000000..53b66398b3 --- /dev/null +++ b/schemas/test/en/test_section_summary.json @@ -0,0 +1,284 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "999", + "title": "Section Summary", + "description": "A questionnaire to test section summaries", + "theme": "default", + "navigation": { + "visible": true + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": true + } + } + }, + "sections": [ + { + "id": "property-details-section", + "title": "Property Details Section", + "summary": { + "page_title": "Custom section summary title", + "show_on_completion": true + }, + "groups": [ + { + "id": "property-details", + "title": "Property Details", + "blocks": [ + { + "id": "insurance-type", + "type": "Question", + "question": { + "id": "insurance-type-question", + "title": "What kind of insurance would you like?", + "type": "General", + "answers": [ + { + "id": "insurance-type-answer", + "type": "Radio", + "mandatory": false, + "options": [ + { + "label": "Buildings", + "value": "Buildings" + }, + { + "label": "Contents", + "value": "Contents" + }, + { + "label": "Both", + "value": "Both" + } + ] + } + ] + } + }, + { + "id": "insurance-address", + "type": "Question", + "question": { + "id": "insurance-address-question", + "title": "What is the address you would like to insure?", + "type": "General", + "answers": [ + { + "id": "insurance-address-answer", + "type": "TextArea", + "mandatory": false + } + ] + } + } + ] + }, + { + "id": "address-length", + "title": "Address Duration", + "blocks": [ + { + "id": "address-duration", + "type": "Question", + "question": { + "id": "address-duration-question", + "title": "Have you been living at this address for over 5 years?", + "type": "General", + "answers": [ + { + "id": "address-duration-answer", + "type": "Radio", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "skip_conditions": { + "when": { + "==": [ + { + "source": "answers", + "identifier": "insurance-type-answer" + }, + "Both" + ] + } + } + } + ] + }, + { + "id": "address-listed", + "title": "Listed Status", + "blocks": [ + { + "id": "listed", + "type": "Question", + "question": { + "id": "listed-question", + "title": "Does this address have Listed status?", + "type": "General", + "answers": [ + { + "id": "listed-answer", + "type": "Radio", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "house-details-section", + "title": "House Details Section", + "summary": { + "show_on_completion": true, + "title": { + "text": "Household Summary - {house_type_answer}", + "placeholders": [ + { + "placeholder": "house_type_answer", + "value": { + "source": "answers", + "identifier": "house-type-answer" + } + } + ] + } + }, + "groups": [ + { + "id": "house-details", + "title": "House Details", + "blocks": [ + { + "id": "house-type", + "type": "Question", + "question": { + "id": "house-type-question", + "title": "What kind of house is it?", + "type": "General", + "answers": [ + { + "id": "house-type-answer", + "type": "Radio", + "mandatory": false, + "options": [ + { + "label": "Detached", + "value": "Detached" + }, + { + "label": "Semi-detached", + "value": "Semi-detached" + }, + { + "label": "Terrace", + "value": "Terrace" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "household-count-section", + "title": "Household member count", + "summary": { + "show_on_completion": true, + "title": { + "text_plural": { + "forms": { + "one": "{number_of_people} person lives here", + "other": "{number_of_people} people live here" + }, + "count": { + "source": "answers", + "identifier": "number-of-people-answer" + } + }, + "placeholders": [ + { + "placeholder": "number_of_people", + "value": { + "source": "answers", + "identifier": "number-of-people-answer" + } + } + ] + } + }, + "groups": [ + { + "id": "number-of-people-group", + "title": "Number of people", + "blocks": [ + { + "type": "Question", + "id": "number-of-people", + "question": { + "answers": [ + { + "id": "number-of-people-answer", + "label": "Number of people", + "mandatory": true, + "type": "Number" + } + ], + "id": "number-of-people-question", + "title": "Title", + "type": "General" + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_show_section_summary_on_completion.json b/schemas/test/en/test_show_section_summary_on_completion.json new file mode 100644 index 0000000000..25317ebfc0 --- /dev/null +++ b/schemas/test/en/test_show_section_summary_on_completion.json @@ -0,0 +1,201 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Show summary on section completion", + "theme": "default", + "description": "A questionnaire to demo the `show_on_completion` functionality", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { + "required_completed_sections": ["employment-section"] + } + }, + "sections": [ + { + "id": "employment-section", + "title": "Employment", + "summary": { + "show_on_completion": false + }, + "groups": [ + { + "id": "radio", + "title": "Radio Optional", + "blocks": [ + { + "type": "Question", + "id": "employment-status", + "question": { + "answers": [ + { + "id": "employment-status-answer", + "mandatory": false, + "options": [ + { + "label": "Working as an employee", + "value": "Working as an employee" + }, + { + "label": "Self-employed or freelance", + "value": "Self-employed or freelance" + }, + { + "label": "Temporarily away from work ill, on holiday or temporarily laid off", + "value": "Temporarily away from work ill, on holiday or temporarily laid off" + }, + { + "label": "On maternity or paternity leave", + "value": "On maternity or paternity leave" + }, + { + "label": "Doing any other kind of paid work", + "value": "Doing any other kind of paid work" + } + ], + "type": "Checkbox" + }, + { + "id": "employment-status-answer-exclusive", + "mandatory": false, + "options": [ + { + "label": "None of these apply", + "value": "None of these apply" + } + ], + "type": "Checkbox" + } + ], + "guidance": { + "contents": [ + { + "description": "Include casual or temporary work, even if only for one hour" + } + ] + }, + "id": "employment-status-question", + "mandatory": true, + "title": "In the last seven days, were you doing any of the following?", + "type": "MutuallyExclusive" + }, + "routing_rules": [ + { + "block": "employment-type", + "when": { + "==": [ + { + "identifier": "employment-status-answer", + "source": "answers" + }, + null + ] + } + }, + { + "group": "checkboxes" + } + ] + }, + { + "type": "Question", + "id": "employment-type", + "question": { + "answers": [ + { + "id": "employment-type-answer", + "mandatory": false, + "options": [ + { + "description": "Whether receiving a pension or not", + "label": "Retired", + "value": "Retired" + }, + { + "label": "Studying", + "value": "Studying" + }, + { + "label": "Looking after home or family", + "value": "Looking after home or family" + }, + { + "label": "Long-term sick or disabled", + "value": "Long-term sick or disabled" + }, + { + "label": "Other", + "value": "Other" + } + ], + "type": "Checkbox" + } + ], + "id": "employment-type-question", + "title": "Which of the following describes what you were doing in the last seven days?", + "type": "General" + } + } + ] + } + ] + }, + { + "id": "accommodation-section", + "title": "Accommodation", + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "blocks": [ + { + "id": "proxy", + "question": { + "answers": [ + { + "default": "Yes", + "id": "proxy-answer", + "mandatory": false, + "options": [ + { + "label": "No, I’m answering for myself", + "value": "No, I’m answering for myself" + }, + { + "label": "Yes", + "value": "Yes" + } + ], + "type": "Radio" + } + ], + "id": "proxy-question", + "title": "Are you answering the questions on behalf of someone else?", + "type": "General" + }, + "type": "Question" + } + ], + "id": "checkboxes" + } + ] + } + ] +} diff --git a/schemas/test/en/test_skip_condition_answer_comparison.json b/schemas/test/en/test_skip_condition_answer_comparison.json new file mode 100644 index 0000000000..b55936ef26 --- /dev/null +++ b/schemas/test/en/test_skip_condition_answer_comparison.json @@ -0,0 +1,157 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Routing Answer Comparisons", + "theme": "default", + "legal_basis": "StatisticsOfTradeAct", + "description": "A test survey for routing based comparison with answers", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "comparison-1", + "question": { + "answers": [ + { + "id": "comparison-1-answer", + "label": "1st Number", + "mandatory": true, + "type": "Number" + } + ], + "id": "comparison-1-question", + "title": "Enter your first number", + "type": "General" + } + }, + { + "type": "Question", + "id": "comparison-2", + "question": { + "answers": [ + { + "id": "comparison-2-answer", + "label": "2nd Number", + "mandatory": true, + "type": "Number" + } + ], + "id": "comparison-2-question", + "title": "Enter your second number", + "type": "General" + } + }, + { + "type": "Interstitial", + "id": "equals-answers", + "content": { + "title": "Answers equal", + "contents": [ + { + "description": "Your second number was equal to your first number" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [ + { + "identifier": "comparison-1-answer", + "source": "answers" + }, + { + "source": "answers", + "identifier": "comparison-2-answer" + } + ] + } + } + }, + { + "type": "Interstitial", + "id": "less-than-answers", + "content": { + "title": "First less than second", + "contents": [ + { + "description": "Your first answer was less than your second number" + } + ] + }, + "skip_conditions": { + "when": { + ">=": [ + { + "identifier": "comparison-1-answer", + "source": "answers" + }, + { + "identifier": "comparison-2-answer", + "source": "answers" + } + ] + } + } + }, + { + "type": "Interstitial", + "id": "greater-than-answers", + "content": { + "title": "First greater than second", + "contents": [ + { + "description": "Your first answer was greater than your second number" + } + ] + }, + "skip_conditions": { + "when": { + "<=": [ + { + "identifier": "comparison-1-answer", + "source": "answers" + }, + { + "source": "answers", + "identifier": "comparison-2-answer" + } + ] + } + } + } + ], + "id": "skip-group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_skip_condition_block.json b/schemas/test/en/test_skip_condition_block.json new file mode 100644 index 0000000000..389aa2095e --- /dev/null +++ b/schemas/test/en/test_skip_condition_block.json @@ -0,0 +1,100 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Skip block", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "default-group", + "title": "Group 1", + "blocks": [ + { + "type": "Question", + "id": "do-you-want-to-skip", + "question": { + "id": "do-you-want-to-skip-question", + "title": "Do you want to skip the next question?", + "type": "General", + "description": ["Select “Yes” to skip the next question and go straight to the summary"], + "answers": [ + { + "id": "do-you-want-to-skip-answer", + "label": "Select an answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ] + } + }, + { + "type": "Question", + "id": "should-skip", + "question": { + "id": "should-skip-question", + "title": "Why didn’t you skip the block?", + "type": "General", + "answers": [ + { + "id": "should-skip-answer", + "label": "Enter your answer", + "mandatory": true, + "type": "TextArea" + } + ] + }, + "skip_conditions": { + "when": { + "==": [ + { + "source": "answers", + "identifier": "do-you-want-to-skip-answer" + }, + "Yes" + ] + } + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_skip_condition_group.json b/schemas/test/en/test_skip_condition_group.json new file mode 100644 index 0000000000..1640b7ee88 --- /dev/null +++ b/schemas/test/en/test_skip_condition_group.json @@ -0,0 +1,106 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Skip group", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "default-group", + "title": "Group 1", + "blocks": [ + { + "type": "Question", + "id": "do-you-want-to-skip", + "question": { + "id": "do-you-want-to-skip-question", + "title": "Do you want to skip the next question?", + "type": "General", + "description": ["Select “Yes” to skip the next question and go straight to the summary"], + "answers": [ + { + "id": "do-you-want-to-skip-answer", + "label": "Select an answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ] + } + } + ] + }, + { + "id": "should-skip-group", + "title": "Group 2 (Skippable)", + "skip_conditions": { + "when": { + "==": [ + { + "source": "answers", + "identifier": "do-you-want-to-skip-answer" + }, + "Yes" + ] + } + }, + "blocks": [ + { + "type": "Question", + "id": "should-skip", + "question": { + "id": "should-skip-question", + "title": "Why didn’t you skip the group?", + "type": "General", + "answers": [ + { + "id": "should-skip-answer", + "label": "Enter your answer", + "mandatory": true, + "type": "TextArea" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_skip_condition_list.json b/schemas/test/en/test_skip_condition_list.json new file mode 100644 index 0000000000..4061083936 --- /dev/null +++ b/schemas/test/en/test_skip_condition_list.json @@ -0,0 +1,272 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test List Skip Conditions", + "theme": "default", + "description": "A questionnaire to test list skip conditions", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": "Household members", + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "id": "more-than-two-interstitial", + "content": { + "title": "Skippable page - More than two people", + "contents": [ + { + "description": "This page is only displayed when there are more than two people in the list" + } + ] + }, + "skip_conditions": { + "when": { + "<": [ + { + "count": [ + { + "source": "list", + "identifier": "people" + } + ] + }, + 3 + ] + } + }, + "type": "Interstitial" + }, + { + "id": "two-interstitial", + "content": { + "title": "Skippable page - Two people", + "contents": [ + { + "description": "This page is only displayed when there are two people in the list" + } + ] + }, + "skip_conditions": { + "when": { + "!=": [ + { + "count": [ + { + "source": "list", + "identifier": "people" + } + ] + }, + 2 + ] + } + }, + "type": "Interstitial" + }, + { + "id": "less-than-two-interstitial", + "content": { + "title": "Skippable page - Less than two people", + "contents": [ + { + "description": "This page is only displayed when there are less than two people in the list" + } + ] + }, + "skip_conditions": { + "when": { + ">": [ + { + "count": [ + { + "source": "list", + "identifier": "people" + } + ] + }, + 1 + ] + } + }, + "type": "Interstitial" + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_skip_condition_not_set.json b/schemas/test/en/test_skip_condition_not_set.json new file mode 100644 index 0000000000..80a871d6dd --- /dev/null +++ b/schemas/test/en/test_skip_condition_not_set.json @@ -0,0 +1,110 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test not set skip condition", + "theme": "default", + "description": "A questionnaire to test skip condition not set.", + "messages": {}, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "food-block", + "question": { + "answers": [ + { + "id": "food-answer", + "label": "What is your favourite breakfast food", + "mandatory": false, + "options": [ + { + "label": "Bacon", + "value": "Bacon" + }, + { + "label": "Eggs", + "value": "Eggs" + } + ], + "type": "Radio" + } + ], + "id": "food-question", + "title": "Title", + "type": "General" + } + }, + { + "type": "Question", + "id": "drink-block", + "question": { + "answers": [ + { + "id": "drink-answer", + "label": "What is your favourite breakfast beverage", + "mandatory": false, + "options": [ + { + "label": "Tea", + "value": "Tea" + }, + { + "label": "Coffee", + "value": "Coffee" + } + ], + "type": "Radio" + } + ], + "id": "drink-section", + "title": "What beverage would you like to accompany your choice of breakfast?", + "type": "General" + }, + "skip_conditions": { + "when": { + "==": [ + { + "identifier": "food-answer", + "source": "answers" + }, + null + ] + } + } + } + ], + "id": "breakfast" + } + ] + } + ] +} diff --git a/schemas/test/en/test_skip_condition_set.json b/schemas/test/en/test_skip_condition_set.json new file mode 100644 index 0000000000..993fb59e34 --- /dev/null +++ b/schemas/test/en/test_skip_condition_set.json @@ -0,0 +1,110 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test set skip condition", + "theme": "default", + "description": "A questionnaire to test skip condition set.", + "messages": {}, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "food-block", + "question": { + "answers": [ + { + "id": "food-answer", + "label": "What is your favourite breakfast food", + "mandatory": false, + "options": [ + { + "label": "Bacon", + "value": "Bacon" + }, + { + "label": "Eggs", + "value": "Eggs" + } + ], + "type": "Radio" + } + ], + "id": "food-question", + "title": "Title", + "type": "General" + } + }, + { + "type": "Question", + "id": "drink-block", + "question": { + "answers": [ + { + "id": "drink-answer", + "label": "What is your favourite breakfast beverage", + "mandatory": false, + "options": [ + { + "label": "Tea", + "value": "Tea" + }, + { + "label": "Coffee", + "value": "Coffee" + } + ], + "type": "Radio" + } + ], + "id": "drink-section", + "title": "What beverage would you like to accompany your choice of breakfast?", + "type": "General" + }, + "skip_conditions": { + "when": { + "!=": [ + { + "identifier": "food-answer", + "source": "answers" + }, + null + ] + } + } + } + ], + "id": "breakfast" + } + ] + } + ] +} diff --git a/schemas/test/en/test_submit_with_custom_submission_text.json b/schemas/test/en/test_submit_with_custom_submission_text.json new file mode 100644 index 0000000000..e4401d211c --- /dev/null +++ b/schemas/test/en/test_submit_with_custom_submission_text.json @@ -0,0 +1,72 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Submit without summary", + "theme": "default", + "description": "A questionnaire to demo submit without summary.", + "navigation": { + "visible": true + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": {} + }, + "submission": { + "button": "Submit", + "guidance": "Thank you for your answers, submit this to complete it", + "title": "Submit your questionnaire", + "warning": "You cannot view your answers after submission" + }, + "sections": [ + { + "id": "first-group", + "title": "First group", + "groups": [ + { + "blocks": [ + { + "type": "Introduction", + "id": "introduction" + }, + { + "type": "Question", + "id": "breakfast", + "question": { + "answers": [ + { + "id": "breakfast-answer", + "label": "What is your favourite breakfast food", + "mandatory": false, + "type": "TextField" + } + ], + "id": "breakfast-question", + "title": "What is your favourite breakfast food", + "type": "General" + } + } + ], + "id": "final-confirmation", + "title": "First group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_submit_with_summary.json b/schemas/test/en/test_submit_with_summary.json new file mode 100644 index 0000000000..3a8a3af974 --- /dev/null +++ b/schemas/test/en/test_submit_with_summary.json @@ -0,0 +1,191 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Other input fields", + "theme": "default", + "description": "A questionnaire to demo radio field Other input.", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "title": "test", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "radio", + "question": { + "answers": [ + { + "id": "radio-answer", + "mandatory": false, + "options": [ + { + "label": "None", + "value": "None" + }, + { + "label": "Bacon", + "value": "Bacon" + }, + { + "label": "Eggs", + "value": "Eggs" + }, + { + "label": "Sausage", + "value": "Sausage" + }, + { + "label": "Other", + "value": "Other", + "description": "An answer is required", + "detail_answer": { + "mandatory": false, + "id": "radio-answer-other", + "label": "Please specify other", + "type": "TextField" + } + } + ], + "type": "Radio" + } + ], + "id": "radio-question", + "title": "What is your favourite breakfast food?", + "type": "General" + } + } + ], + "id": "radio-group" + }, + { + "blocks": [ + { + "type": "Question", + "id": "dessert", + "question": { + "id": "dessert-question", + "title": "What is your favourite dessert?", + "type": "General", + "answers": [ + { + "id": "dessert-answer", + "label": "Dessert", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + { + "type": "Question", + "id": "dessert-confirmation", + "question": { + "id": "test-dessert-confirmation-question", + "title": { + "text": "Are you sure {dessert} is your favourite?", + "placeholders": [ + { + "placeholder": "dessert", + "value": { + "source": "answers", + "identifier": "dessert-answer" + } + } + ] + }, + "type": "General", + "answers": [ + { + "id": "dessert-confirmation-answer", + "label": "Radio", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + } + ], + "id": "dessert-group", + "title": "Dessert" + }, + { + "blocks": [ + { + "type": "Question", + "id": "numbers", + "question": { + "answers": [ + { + "id": "numbers-currency-answer", + "label": "Currency", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "numbers-unit-answer", + "label": "Kilometres Square", + "mandatory": false, + "type": "Unit", + "unit_length": "short", + "unit": "area-square-kilometer" + }, + { + "id": "numbers-decimal-answer", + "label": "Decimal (to 2 decimal places)", + "mandatory": false, + "type": "Number", + "decimal_places": 2 + } + ], + "id": "numbers-question", + "title": "What are the test values?", + "type": "General" + } + } + ], + "id": "numbers-group", + "title": "Numbers" + } + ] + } + ] +} diff --git a/schemas/test/en/test_submit_with_summary_custom_submission_text.json b/schemas/test/en/test_submit_with_summary_custom_submission_text.json new file mode 100644 index 0000000000..07943d2b69 --- /dev/null +++ b/schemas/test/en/test_submit_with_summary_custom_submission_text.json @@ -0,0 +1,69 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Other input fields", + "theme": "default", + "description": "Test a Summary page with submission content set", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "submission": { + "button": "Submission button", + "guidance": "Submission guidance", + "title": "Submission title", + "warning": "Submission warning" + }, + "sections": [ + { + "id": "default-section", + "title": "test", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "dessert-block", + "question": { + "id": "test-dessert-question", + "title": "What is your favourite dessert?", + "type": "General", + "answers": [ + { + "id": "dessert", + "label": "What is your favourite dessert?", + "mandatory": true, + "type": "TextField" + } + ] + } + } + ], + "id": "dessert-group", + "title": "Dessert" + } + ] + } + ] +} diff --git a/schemas/test/en/test_submit_with_summary_return_to_answer.json b/schemas/test/en/test_submit_with_summary_return_to_answer.json new file mode 100644 index 0000000000..77d83caae0 --- /dev/null +++ b/schemas/test/en/test_submit_with_summary_return_to_answer.json @@ -0,0 +1,233 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "999", + "title": "Section summary with return to answer", + "description": "A questionnaire to test scrolling to answers on summary page", + "theme": "default", + "navigation": { + "visible": true + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": true + } + } + }, + "sections": [ + { + "id": "property-details-section", + "title": "Property Details Section", + "summary": { + "page_title": "Custom section summary title", + "show_on_completion": true + }, + "groups": [ + { + "id": "name-details", + "title": "Name Details", + "blocks": [ + { + "type": "Question", + "id": "name", + "question": { + "id": "name-question", + "title": "Name", + "type": "General", + "summary": { + "concatenation_type": "Space" + }, + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": false, + "type": "TextField" + }, + { + "id": "middle-name", + "label": "Middle name", + "mandatory": false, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": false, + "type": "TextField" + } + ] + } + } + ] + }, + { + "id": "property-details", + "title": "Property Details", + "blocks": [ + { + "id": "insurance-type", + "type": "Question", + "question": { + "id": "insurance-type-question", + "title": "What kind of insurance would you like?", + "type": "General", + "answers": [ + { + "id": "insurance-type-answer", + "type": "Radio", + "mandatory": false, + "options": [ + { + "label": "Buildings", + "value": "Buildings" + }, + { + "label": "Contents", + "value": "Contents" + }, + { + "label": "Both", + "value": "Both" + } + ] + } + ] + } + }, + { + "id": "insurance-address", + "type": "Question", + "question": { + "id": "insurance-address-question", + "title": "What are the addresses you would like to insure?", + "type": "General", + "answers": [ + { + "id": "insurance-address-answer1", + "type": "TextArea", + "mandatory": false, + "label": "Insurance address answer 1" + }, + { + "id": "insurance-address-answer2", + "type": "TextArea", + "mandatory": false, + "label": "Insurance address answer 2" + } + ] + } + } + ] + }, + { + "id": "address-length", + "title": "Address Duration", + "blocks": [ + { + "id": "address-duration", + "type": "Question", + "question": { + "id": "address-duration-question", + "title": "Have you been living at this address for over 5 years?", + "type": "General", + "answers": [ + { + "id": "address-duration-answer", + "type": "Radio", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "house-details-section", + "title": "House Details Section", + "summary": { + "show_on_completion": true, + "title": { + "text": "Household Summary - {house_type_answer}", + "placeholders": [ + { + "placeholder": "house_type_answer", + "value": { + "source": "answers", + "identifier": "house-type-answer" + } + } + ] + } + }, + "groups": [ + { + "id": "house-details", + "title": "House Details", + "blocks": [ + { + "id": "house-type", + "type": "Question", + "question": { + "id": "house-type-question", + "title": "What kind of house is it?", + "type": "General", + "answers": [ + { + "id": "house-type-answer", + "type": "Radio", + "mandatory": false, + "options": [ + { + "label": "Detached", + "value": "Detached" + }, + { + "label": "Semi-detached", + "value": "Semi-detached" + }, + { + "label": "Terrace", + "value": "Terrace" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_supplementary_data.json b/schemas/test/en/test_supplementary_data.json new file mode 100644 index 0000000000..8b541a4e09 --- /dev/null +++ b/schemas/test/en/test_supplementary_data.json @@ -0,0 +1,1950 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "123", + "title": "Test Supplementary Data", + "theme": "default", + "description": "A questionnaire to demo using Supplementary data for placeholders, validation and routing in both repeating and non repeating sections.", + "metadata": [ + { + "name": "survey_id", + "type": "string" + }, + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + }, + { + "name": "sds_dataset_id", + "type": "string" + } + ], + "supplementary_data": { + "lists": ["employees", "products"] + }, + "questionnaire_flow": { + "type": "Hub", + "options": { + "required_completed_sections": ["introduction-section"] + } + }, + "post_submission": { + "view_response": true + }, + "sections": [ + { + "id": "introduction-section", + "title": "Introduction", + "groups": [ + { + "id": "introduction-group", + "title": "Introduction Group", + "blocks": [ + { + "id": "loaded-successfully-block", + "type": "Interstitial", + "content": { + "title": "Supplementary Data", + "contents": [ + { + "title": "You have successfully loaded Supplementary data", + "description": { + "text": "List of products: {products}", + "placeholders": [ + { + "placeholder": "products", + "transforms": [ + { + "transform": "format_list", + "arguments": { + "list_to_format": { + "source": "supplementary_data", + "identifier": "products", + "selectors": ["name"] + } + } + } + ] + } + ] + }, + "guidance": { + "contents": [ + { + "description": { + "text": "The purpose of this block, is to test that supplementary data loads successfully, separate to using the supplementary data. The surnames of the employees are: {surnames}.", + "placeholders": [ + { + "placeholder": "surnames", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "supplementary_data", + "identifier": "employees", + "selectors": ["personal_details", "surname"] + } + ], + "delimiter": ", " + } + } + ] + } + ] + } + } + ] + } + } + ] + } + }, + { + "id": "introduction-block", + "type": "Introduction", + "primary_content": [ + { + "id": "business-details", + "title": { + "text": "You are completing this survey for {company_name}", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "supplementary_data", + "identifier": "company_name" + } + } + ] + }, + "contents": [ + { + "description": { + "text": "If the company details or structure have changed contact us on {telephone_number_link}", + "placeholders": [ + { + "placeholder": "telephone_number_link", + "value": { + "source": "supplementary_data", + "identifier": "company_details", + "selectors": ["telephone_number"] + } + } + ] + } + }, + { + "guidance": { + "contents": [ + { + "title": "Guidance for completing this survey", + "list": [ + "The company name, telephone number all come from supplementary data", + "if you picked the supplementary dataset with guidance, there will be a 3rd bullet point below this one, with the supplementary guidance.", + { + "text": "{survey_guidance}", + "placeholders": [ + { + "placeholder": "survey_guidance", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "supplementary_data", + "identifier": "guidance" + } + ] + } + } + ] + } + ] + } + ] + } + ] + } + } + ] + } + ] + } + ] + } + ] + }, + { + "id": "section-1", + "title": "Company Details", + "summary": { + "page_title": "Summary title", + "show_on_completion": true + }, + "groups": [ + { + "id": "introduction", + "title": "Group 1", + "blocks": [ + { + "id": "email-block", + "type": "Question", + "question": { + "id": "email-question", + "type": "General", + "guidance": { + "contents": [ + { + "description": "If you answer no, an additional block will open up allowing entering of a different email" + } + ] + }, + "title": { + "text": "Is {email} still the correct contact email for {company_name}?", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "supplementary_data", + "identifier": "company_name" + } + }, + { + "placeholder": "email", + "value": { + "source": "supplementary_data", + "identifier": "company_details", + "selectors": ["email"] + } + } + ] + }, + "answers": [ + { + "id": "same-email-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + { + "skip_conditions": { + "when": { + "==": [ + { + "source": "answers", + "identifier": "same-email-answer" + }, + "Yes" + ] + } + }, + "type": "Question", + "id": "new-email", + "question": { + "id": "new-email-question", + "type": "General", + "title": { + "text": "What is the new contact email for {company_name}?", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "supplementary_data", + "identifier": "company_name" + } + } + ] + }, + "answers": [ + { + "id": "new-email-answer", + "label": "Contact email", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + { + "type": "Question", + "id": "trading", + "question": { + "id": "trading-question", + "type": "General", + "title": { + "text": "When did {company_name} begin trading?", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "supplementary_data", + "identifier": "company_name" + } + } + ] + }, + "answers": [ + { + "id": "trading-answer", + "label": "Date commenced", + "mandatory": true, + "type": "Radio", + "dynamic_options": { + "values": { + "map": [ + { + "format-date": ["self", "yyyy-MM-dd"] + }, + { + "date-range": [ + { + "date": [ + { + "source": "supplementary_data", + "identifier": "incorporation_date" + } + ] + }, + 7 + ] + } + ] + }, + "transform": { + "format-date": [ + { + "date": ["self"] + }, + "EEEE d MMMM yyyy" + ] + } + } + } + ] + } + }, + { + "type": "Question", + "id": "sales-breakdown-block", + "question": { + "id": "sales-breakdown-question", + "title": { + "text": "How much of the {sales} total UK sales was from Bristol and London?", + "placeholders": [ + { + "placeholder": "sales", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "source": "supplementary_data", + "identifier": "total_uk_sales" + } + } + } + ] + } + ] + }, + "type": "Calculated", + "warning": "These answers must not exceed the reported total from the supplementary data", + "calculations": [ + { + "calculation_type": "sum", + "value": { + "source": "supplementary_data", + "identifier": "total_uk_sales" + }, + "answers_to_calculate": ["sales-bristol-answer", "sales-london-answer"], + "conditions": ["less than", "equals"] + } + ], + "answers": [ + { + "id": "sales-bristol-answer", + "label": "Bristol Sales", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "sales-london-answer", + "label": "London Sales", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-sales", + "title": "Total value of sales from Bristol and London is calculated to be %(total)s. Is this correct?", + "calculation": { + "title": "Total sales", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "sales-london-answer" + }, + { + "source": "answers", + "identifier": "sales-bristol-answer" + } + ] + } + } + }, + { + "id": "section-1-interstitial", + "type": "Interstitial", + "content": { + "title": { + "text": "Summary of information provided for {company_name}", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "supplementary_data", + "identifier": "company_name" + } + } + ] + }, + "contents": [ + { + "list": [ + { + "text": "Telephone Number: {phone}", + "placeholders": [ + { + "placeholder": "phone", + "value": { + "source": "supplementary_data", + "identifier": "company_details", + "selectors": ["telephone_number"] + } + } + ] + }, + { + "text": "Email: {company_email}", + "placeholders": [ + { + "placeholder": "company_email", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "answers", + "identifier": "new-email-answer" + }, + { + "source": "supplementary_data", + "identifier": "company_details", + "selectors": ["email"] + } + ] + } + } + ] + } + ] + }, + { + "text": "Note Title: {note_title}", + "placeholders": [ + { + "placeholder": "note_title", + "value": { + "source": "supplementary_data", + "identifier": "note", + "selectors": ["title"] + } + } + ] + }, + { + "text": "Note Description: {note_description}", + "placeholders": [ + { + "placeholder": "note_description", + "value": { + "source": "supplementary_data", + "identifier": "note", + "selectors": ["description"] + } + } + ] + }, + { + "text": "Note Example Title: {note_title}", + "placeholders": [ + { + "placeholder": "note_title", + "value": { + "source": "supplementary_data", + "identifier": "note", + "selectors": ["example", "title"] + } + } + ] + }, + { + "text": "Note Example Description: {note_description}", + "placeholders": [ + { + "placeholder": "note_description", + "value": { + "source": "supplementary_data", + "identifier": "note", + "selectors": ["example", "description"] + } + } + ] + }, + { + "text": "Incorporation Date: {incorporation_date}", + "placeholders": [ + { + "placeholder": "incorporation_date", + "transforms": [ + { + "arguments": { + "date_format": "d MMMM yyyy", + "date_to_format": { + "source": "supplementary_data", + "identifier": "incorporation_date" + } + }, + "transform": "format_date" + } + ] + } + ] + }, + { + "text": "Trading start date: {trading_date}", + "placeholders": [ + { + "placeholder": "trading_date", + "transforms": [ + { + "arguments": { + "date_format": "d MMMM yyyy", + "date_to_format": { + "source": "answers", + "identifier": "trading-answer" + } + }, + "transform": "format_date" + } + ] + } + ] + }, + { + "text": "Guidance: {guidance}", + "placeholders": [ + { + "placeholder": "guidance", + "value": { + "source": "supplementary_data", + "identifier": "guidance" + } + } + ] + }, + { + "text": "Total Uk Sales: {sales}", + "placeholders": [ + { + "placeholder": "sales", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "source": "supplementary_data", + "identifier": "total_uk_sales" + } + } + } + ] + } + ] + }, + { + "text": "Bristol sales: {bristol_sales}", + "placeholders": [ + { + "placeholder": "bristol_sales", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "source": "answers", + "identifier": "sales-bristol-answer" + } + } + } + ] + } + ] + }, + { + "text": "London sales: {london_sales}", + "placeholders": [ + { + "placeholder": "london_sales", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "source": "answers", + "identifier": "sales-london-answer" + } + } + } + ] + } + ] + }, + { + "text": "Sum of Bristol and London sales: {total_sales}", + "placeholders": [ + { + "placeholder": "total_sales", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "source": "calculated_summary", + "identifier": "calculated-summary-sales" + } + } + } + ] + } + ] + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "section-2", + "title": "Employees", + "groups": [ + { + "id": "employee-reporting", + "blocks": [ + { + "id": "list-collector-employees", + "type": "ListCollectorContent", + "page_title": "Employees", + "for_list": "employees", + "content": { + "title": "Employees", + "contents": [ + { + "definition": { + "title": "Company employees", + "contents": [ + { + "description": "List of previously reported employees." + } + ] + } + }, + { + "description": "You have previously reported on the above employees. Press continue to proceed to the next section where you can add any additional employees." + } + ] + }, + "summary": { + "title": "employees", + "item_title": { + "text": "{employee_name}", + "placeholders": [ + { + "placeholder": "employee_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "supplementary_data", + "identifier": "employees", + "selectors": ["personal_details", "forename"] + }, + { + "source": "supplementary_data", + "identifier": "employees", + "selectors": ["personal_details", "surname"] + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "section-3", + "title": "Additional Employees", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "additional-employees", + "title": "employees", + "add_link_text": "Add another employee", + "empty_list_text": "There are no employees" + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "additional-employee-reporting", + "blocks": [ + { + "type": "ListCollectorDrivingQuestion", + "id": "any-additional-employees", + "for_list": "additional-employees", + "question": { + "type": "General", + "id": "any-additional-employee-question", + "title": "Do you have any additional employees to report on?", + "guidance": { + "contents": [ + { + "description": "This uses a different employees list, and the items from this list and the supplementary list will then be used in repeating sections" + } + ] + }, + "answers": [ + { + "type": "Radio", + "id": "any-additional-employee-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-additional-employee", + "list_name": "additional-employees" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "section": "End", + "when": { + "==": [ + { + "source": "answers", + "identifier": "any-additional-employee-answer" + }, + "No" + ] + } + }, + { + "block": "list-collector-additional" + } + ] + }, + { + "id": "list-collector-additional", + "type": "ListCollector", + "for_list": "additional-employees", + "question": { + "id": "confirmation-additional-question", + "type": "General", + "title": "Do you need to add any more employees?", + "answers": [ + { + "id": "list-collector-additional-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-additional-employee", + "type": "ListAddQuestion", + "cancel_text": "Don’t need to add any other employees?", + "question": { + "id": "add-additional-question", + "type": "General", + "title": "What is the name of the employee?", + "answers": [ + { + "id": "employee-first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "employee-last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-additional-employee", + "type": "ListEditQuestion", + "cancel_text": "Don’t need to change anything?", + "question": { + "id": "edit-additional-question", + "type": "General", + "title": "What is the name of the employee?", + "answers": [ + { + "id": "employee-first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "employee-last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-additional-employee", + "type": "ListRemoveQuestion", + "cancel_text": "Don’t need to remove this employee?", + "question": { + "id": "remove-additional-question", + "type": "General", + "title": "Are you sure you want to remove this employee?", + "warning": "All of the information about this employee will be deleted", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "employees", + "item_title": { + "text": "{employee_name}", + "placeholders": [ + { + "placeholder": "employee_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "employee-first-name" + }, + { + "source": "answers", + "identifier": "employee-last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "enabled": { + "when": { + "and": [ + { + "==": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-2" + }, + "COMPLETED" + ] + }, + { + "==": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-3" + }, + "COMPLETED" + ] + } + ] + } + }, + "id": "section-4", + "title": "Employee Details", + "summary": { + "show_on_completion": true + }, + "repeat": { + "for_list": "employees", + "title": { + "text": "{employee_name}", + "placeholders": [ + { + "placeholder": "employee_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "supplementary_data", + "identifier": "employees", + "selectors": ["personal_details", "forename"] + }, + { + "source": "supplementary_data", + "identifier": "employees", + "selectors": ["personal_details", "surname"] + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + }, + "groups": [ + { + "id": "employee-detail-questions", + "blocks": [ + { + "type": "Question", + "id": "length-of-employment", + "question": { + "id": "length-employment-question", + "type": "General", + "title": { + "text": "When did {employee_name} start working for {company_name}?", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "supplementary_data", + "identifier": "company_name" + } + }, + { + "placeholder": "employee_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "supplementary_data", + "identifier": "employees", + "selectors": ["personal_details", "forename"] + }, + { + "source": "supplementary_data", + "identifier": "employees", + "selectors": ["personal_details", "surname"] + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + }, + "answers": [ + { + "id": "employment-start", + "label": { + "text": "Start date at {company_name}", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "supplementary_data", + "identifier": "company_name" + } + } + ] + }, + "mandatory": true, + "type": "Date", + "maximum": { + "value": "now" + }, + "minimum": { + "value": { + "source": "supplementary_data", + "identifier": "incorporation_date" + } + } + } + ] + } + }, + { + "id": "conditional-employee-block", + "type": "Question", + "skip_conditions": { + "when": { + "!=": [ + { + "count": [ + { + "source": "list", + "identifier": "employees" + } + ] + }, + 3 + ] + } + }, + "question": { + "id": "conditional-employee-question", + "guidance": { + "contents": [ + { + "description": "This block is enabled because there are 3 employees in the supplementary dataset" + } + ] + }, + "type": "General", + "title": { + "text": "Has {employee_name} been promoted since starting at {company_name}?", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "supplementary_data", + "identifier": "company_name" + } + }, + { + "placeholder": "employee_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "supplementary_data", + "identifier": "employees", + "selectors": ["personal_details", "forename"] + }, + { + "source": "supplementary_data", + "identifier": "employees", + "selectors": ["personal_details", "surname"] + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + }, + "answers": [ + { + "id": "promoted-yes-no-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "enabled": { + "when": { + "and": [ + { + "==": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-2" + }, + "COMPLETED" + ] + }, + { + "==": [ + { + "source": "progress", + "selector": "section", + "identifier": "section-3" + }, + "COMPLETED" + ] + } + ] + } + }, + "id": "section-5", + "title": "Additional Employee Details", + "summary": { + "show_on_completion": true + }, + "repeat": { + "for_list": "additional-employees", + "title": { + "text": "{employee_name}", + "placeholders": [ + { + "placeholder": "employee_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "employee-first-name" + }, + { + "source": "answers", + "identifier": "employee-last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + }, + "groups": [ + { + "id": "additional-employee-detail-questions", + "blocks": [ + { + "type": "Question", + "id": "additional-length-of-employment", + "question": { + "id": "additional-length-employment-question", + "type": "General", + "title": { + "text": "When did {employee_name} start working for {company_name}?", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "supplementary_data", + "identifier": "company_name" + } + }, + { + "placeholder": "employee_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "employee-first-name" + }, + { + "source": "answers", + "identifier": "employee-last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + }, + "answers": [ + { + "id": "additional-employment-start", + "label": { + "text": "Start date at {company_name}", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "supplementary_data", + "identifier": "company_name" + } + } + ] + }, + "mandatory": true, + "type": "Date", + "maximum": { + "value": "now" + }, + "minimum": { + "value": { + "source": "supplementary_data", + "identifier": "incorporation_date" + } + } + } + ] + } + }, + { + "id": "conditional-additional-employee-block", + "type": "Question", + "skip_conditions": { + "when": { + "!=": [ + { + "count": [ + { + "source": "list", + "identifier": "additional-employees" + } + ] + }, + 3 + ] + } + }, + "question": { + "id": "conditional-additional-employee-question", + "guidance": { + "contents": [ + { + "description": "This block is enabled because there are 3 additional employees" + } + ] + }, + "type": "General", + "title": { + "text": "Has {employee_name} been promoted since starting at {company_name}?", + "placeholders": [ + { + "placeholder": "company_name", + "value": { + "source": "supplementary_data", + "identifier": "company_name" + } + }, + { + "placeholder": "employee_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "employee-first-name" + }, + { + "source": "answers", + "identifier": "employee-last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + }, + "answers": [ + { + "id": "additional-promoted-yes-no-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "section-6", + "title": "Product details", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "products", + "title": "Products", + "empty_list_text": "There are no products" + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "product-reporting", + "blocks": [ + { + "id": "list-collector-products", + "type": "ListCollectorContent", + "for_list": "products", + "page_title": "Products", + "content": { + "title": "Products", + "contents": [ + { + "description": "You have previously provided information for the above products. Please press continue to proceed to questions on value and volume of sales." + } + ] + }, + "repeating_blocks": [ + { + "id": "product-repeating-block-1", + "type": "ListRepeatingQuestion", + "question": { + "id": "product-repeating-block-1-question", + "type": "General", + "guidance": { + "contents": [ + { + "title": { + "text": "{guidance_include}", + "placeholders": [ + { + "placeholder": "guidance_include", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "supplementary_data", + "identifier": "products", + "selectors": ["guidance_include", "title"] + } + ] + } + } + ] + } + ] + }, + "description": { + "text": "{guidance_include_list}", + "placeholders": [ + { + "placeholder": "guidance_include_list", + "transforms": [ + { + "transform": "format_list", + "arguments": { + "list_to_format": { + "source": "supplementary_data", + "identifier": "products", + "selectors": ["guidance_include", "list"] + } + } + } + ] + } + ] + } + }, + { + "title": { + "text": "{guidance_exclude}", + "placeholders": [ + { + "placeholder": "guidance_exclude", + "transforms": [ + { + "transform": "first_non_empty_item", + "arguments": { + "items": [ + { + "source": "supplementary_data", + "identifier": "products", + "selectors": ["guidance_exclude", "title"] + } + ] + } + } + ] + } + ] + }, + "description": { + "text": "{guidance_exclude_list}", + "placeholders": [ + { + "placeholder": "guidance_exclude_list", + "transforms": [ + { + "transform": "format_list", + "arguments": { + "list_to_format": { + "source": "supplementary_data", + "identifier": "products", + "selectors": ["guidance_exclude", "list"] + } + } + } + ] + } + ] + } + } + ] + }, + "title": { + "text": "Volume of production and sales for {product_name}", + "placeholders": [ + { + "placeholder": "product_name", + "value": { + "source": "supplementary_data", + "identifier": "products", + "selectors": ["name"] + } + } + ] + }, + "answers": [ + { + "id": "product-volume-sales", + "label": { + "text": "{volume_sales} for {product_name}", + "placeholders": [ + { + "placeholder": "volume_sales", + "value": { + "source": "supplementary_data", + "identifier": "products", + "selectors": ["volume_sales", "label"] + } + }, + { + "placeholder": "product_name", + "value": { + "source": "supplementary_data", + "identifier": "products", + "selectors": ["name"] + } + } + ] + }, + "mandatory": false, + "type": "Unit", + "unit": "mass-kilogram", + "unit_length": "short" + }, + { + "id": "product-volume-total", + "label": { + "text": "{total_volume} for {product_name}", + "placeholders": [ + { + "placeholder": "total_volume", + "value": { + "source": "supplementary_data", + "identifier": "products", + "selectors": ["total_volume", "label"] + } + }, + { + "placeholder": "product_name", + "value": { + "source": "supplementary_data", + "identifier": "products", + "selectors": ["name"] + } + } + ] + }, + "mandatory": false, + "type": "Unit", + "unit": "mass-kilogram", + "unit_length": "short" + } + ] + } + } + ], + "summary": { + "title": "products", + "item_title": { + "text": "{product_name}", + "placeholders": [ + { + "placeholder": "product_name", + "value": { + "source": "supplementary_data", + "identifier": "products", + "selectors": ["name"] + } + } + ] + } + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-volume-sales", + "title": "We calculate the total volume of sales over the previous quarter to be %(total)s. Is this correct?", + "calculation": { + "title": "Total sales volume", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "product-volume-sales" + } + ] + } + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-volume-total", + "title": "We calculate the total volume produced over the previous quarter to be %(total)s. Is this correct?", + "calculation": { + "title": "Total volume produced", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "product-volume-total" + } + ] + } + } + }, + { + "type": "Question", + "id": "dynamic-products", + "skip_conditions": { + "when": { + "==": [ + { + "count": [ + { + "source": "list", + "identifier": "products" + } + ] + }, + 0 + ] + } + }, + "question": { + "dynamic_answers": { + "values": { + "source": "list", + "identifier": "products" + }, + "answers": [ + { + "label": { + "text": "{value_sales} for {product_name}", + "placeholders": [ + { + "placeholder": "value_sales", + "value": { + "source": "supplementary_data", + "identifier": "products", + "selectors": ["value_sales", "label"] + } + }, + { + "placeholder": "product_name", + "value": { + "source": "supplementary_data", + "identifier": "products", + "selectors": ["name"] + } + } + ] + }, + "id": "product-sales-answer", + "type": "Currency", + "mandatory": true, + "currency": "GBP", + "decimal_places": 2 + } + ] + }, + "answers": [ + { + "id": "extra-static-answer", + "label": "Value of sales from other categories", + "type": "Currency", + "mandatory": false, + "currency": "GBP", + "decimal_places": 2 + } + ], + "id": "dynamic-answer-question", + "title": "Sales during the previous quarter", + "type": "General" + } + }, + { + "type": "CalculatedSummary", + "id": "calculated-summary-value-sales", + "title": "We calculate the total value of sales over the previous quarter to be %(total)s. Is this correct?", + "calculation": { + "title": "Total sales value", + "operation": { + "+": [ + { + "source": "answers", + "identifier": "product-sales-answer" + }, + { + "source": "answers", + "identifier": "extra-static-answer" + } + ] + } + } + } + ] + } + ] + }, + { + "id": "section-7", + "title": "Sales targets", + "groups": [ + { + "id": "value-sales-group", + "blocks": [ + { + "id": "product-sales-interstitial", + "type": "Interstitial", + "content": { + "title": "Product value sales", + "contents": [ + { + "guidance": { + "contents": [ + { + "description": "The next block only shows when there are 2 products in the supplementary dataset." + }, + { + "description": "This is to test that section progress updates when swapping between supplementary datasets which remove or add list items" + } + ] + } + } + ] + } + }, + { + "id": "product-question-2-enabled", + "type": "Question", + "skip_conditions": { + "when": { + "!=": [ + { + "count": [ + { + "source": "list", + "identifier": "products" + } + ] + }, + 2 + ] + } + }, + "question": { + "id": "product-2-question", + "guidance": { + "contents": [ + { + "description": "This block is enabled because there are 2 products in the supplementary dataset" + } + ] + }, + "type": "General", + "title": { + "text": "Did the total value sales of {value_sales} over the last quarter meet the target?", + "placeholders": [ + { + "placeholder": "value_sales", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "source": "calculated_summary", + "identifier": "calculated-summary-value-sales" + } + } + } + ] + } + ] + }, + "answers": [ + { + "id": "value-yes-no-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + } + ] + } + ] + }, + { + "id": "section-8", + "title": "Production targets", + "groups": [ + { + "id": "volume-produced-group", + "blocks": [ + { + "id": "product-volume-interstitial", + "type": "Interstitial", + "content": { + "title": "Product volume produced", + "contents": [ + { + "guidance": { + "contents": [ + { + "description": "The next block only shows when there are 3 products in the supplementary dataset." + }, + { + "description": "This is to test that section progress updates when swapping between supplementary datasets which remove or add list items" + } + ] + } + } + ] + } + }, + { + "id": "product-question-3-enabled", + "type": "Question", + "skip_conditions": { + "when": { + "!=": [ + { + "count": [ + { + "source": "list", + "identifier": "products" + } + ] + }, + 3 + ] + } + }, + "question": { + "id": "product-3-question", + "guidance": { + "contents": [ + { + "description": "This block is enabled because there are 3 products in the supplementary dataset" + } + ] + }, + "type": "General", + "title": { + "text": "Did the total volume produced of {volume_produced} over the last quarter meet the target?", + "placeholders": [ + { + "placeholder": "volume_produced", + "transforms": [ + { + "transform": "format_unit", + "arguments": { + "value": { + "source": "calculated_summary", + "identifier": "calculated-summary-volume-total" + }, + "unit": "mass-kilogram", + "unit_length": "short" + } + } + ] + } + ] + }, + "answers": [ + { + "id": "volume-yes-no-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_textarea.json b/schemas/test/en/test_textarea.json new file mode 100644 index 0000000000..5029fbace6 --- /dev/null +++ b/schemas/test/en/test_textarea.json @@ -0,0 +1,73 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Other input fields", + "theme": "default", + "description": "A questionnaire to test textareas.", + "messages": { + "NUMBER_TOO_LARGE": "Number is too large", + "NUMBER_TOO_SMALL": "Number cannot be less than zero", + "INVALID_NUMBER": "Please enter an integer" + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "textarea-block", + "question": { + "answers": [ + { + "id": "answer", + "label": "Enter your comments", + "rows": 3, + "mandatory": false, + "type": "TextArea", + "max_length": 20, + "validation": { + "messages": { + "MAX_LENGTH_EXCEEDED": "You have entered too many characters. Enter up to %(max)d characters" + } + } + } + ], + "id": "question", + "title": "Title", + "type": "General" + } + } + ], + "id": "textarea-group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_textfield.json b/schemas/test/en/test_textfield.json new file mode 100644 index 0000000000..8ca7bbc3e1 --- /dev/null +++ b/schemas/test/en/test_textfield.json @@ -0,0 +1,67 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Other input fields", + "theme": "default", + "description": "A questionnaire to test textfields", + "messages": { + "NUMBER_TOO_LARGE": "Number is too large", + "NUMBER_TOO_SMALL": "Number cannot be less than zero", + "INVALID_NUMBER": "Please enter an integer" + }, + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "name-block", + "question": { + "answers": [ + { + "id": "name-answer", + "label": "What is your name?", + "max_length": 20, + "mandatory": false, + "type": "TextField" + } + ], + "id": "name-question", + "title": "Title", + "type": "General" + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_textfield_suggestions.json b/schemas/test/en/test_textfield_suggestions.json new file mode 100644 index 0000000000..b282c33440 --- /dev/null +++ b/schemas/test/en/test_textfield_suggestions.json @@ -0,0 +1,86 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Textfield Suggestions", + "theme": "default", + "description": "A questionnaire to test textfield suggestions", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "country-block", + "question": { + "answers": [ + { + "id": "country-answer", + "label": "Country", + "mandatory": false, + "suggestions": { + "url": "https://cdn.eq.gcp.onsdigital.uk/eq-lookup-suggestions-data/v5.5.0/gb/en/countries-of-birth.json", + "allow_multiple": false + }, + "type": "TextField" + } + ], + "id": "country-of-birth-question", + "title": "What is your country of birth?", + "type": "General" + } + }, + { + "type": "Question", + "id": "multiple-country-block", + "question": { + "answers": [ + { + "id": "multiple-country-answer", + "label": "Passports", + "mandatory": false, + "suggestions": { + "url": "https://cdn.eq.gcp.onsdigital.uk/eq-lookup-suggestions-data/v5.5.0/gb/en/passport-countries.json", + "allow_multiple": true + }, + "type": "TextField" + } + ], + "id": "multiple-country-question", + "title": "What passports do you hold?", + "type": "General" + } + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_thank_you.json b/schemas/test/en/test_thank_you.json new file mode 100644 index 0000000000..57d01e1e1e --- /dev/null +++ b/schemas/test/en/test_thank_you.json @@ -0,0 +1,83 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "001", + "title": "Test Thank You", + "theme": "default", + "description": "A questionnaire to test post submission params", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "post_submission": { + "guidance": { + "contents": [ + { + "description": "This survey was important." + }, + { + "description": "Important link" + } + ] + }, + "view_response": true + }, + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "blocks": [ + { + "id": "did-you-know", + "question": { + "answers": [ + { + "id": "answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "question", + "title": "Did you know this schema is testing post submission params?", + "type": "General" + }, + "type": "Question" + } + ], + "id": "group" + } + ] + } + ] +} diff --git a/schemas/test/en/test_theme_dbt.json b/schemas/test/en/test_theme_dbt.json new file mode 100644 index 0000000000..be7981734c --- /dev/null +++ b/schemas/test/en/test_theme_dbt.json @@ -0,0 +1,75 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Department for Business and Trade", + "theme": "dbt", + "description": "A questionnaire to demo the DBT survey theme", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "radio", + "question": { + "answers": [ + { + "id": "radio-answer", + "mandatory": false, + "options": [ + { + "label": "Bacon", + "value": "Bacon" + }, + { + "label": "Eggs", + "value": "Eggs" + }, + { + "label": "Sausage", + "value": "Sausage" + } + ], + "type": "Radio" + } + ], + "id": "radio-question", + "title": "What is your favourite breakfast food?", + "type": "General" + } + } + ], + "id": "group", + "title": "DBT Theme Test" + } + ] + } + ] +} diff --git a/schemas/test/en/test_theme_dbt_dsit.json b/schemas/test/en/test_theme_dbt_dsit.json new file mode 100644 index 0000000000..0395f918d4 --- /dev/null +++ b/schemas/test/en/test_theme_dbt_dsit.json @@ -0,0 +1,75 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Department for Business and Trade and Department for Science, Innovation and Technology", + "theme": "dbt-dsit", + "description": "A questionnaire to demo the DBT-DSIT survey theme", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "radio", + "question": { + "answers": [ + { + "id": "radio-answer", + "mandatory": false, + "options": [ + { + "label": "Bacon", + "value": "Bacon" + }, + { + "label": "Eggs", + "value": "Eggs" + }, + { + "label": "Sausage", + "value": "Sausage" + } + ], + "type": "Radio" + } + ], + "id": "radio-question", + "title": "What is your favourite breakfast food?", + "type": "General" + } + } + ], + "id": "group", + "title": "DBT-DSIT Theme Test" + } + ] + } + ] +} diff --git a/schemas/test/en/test_theme_dbt_dsit_ni.json b/schemas/test/en/test_theme_dbt_dsit_ni.json new file mode 100644 index 0000000000..8a5cf9c642 --- /dev/null +++ b/schemas/test/en/test_theme_dbt_dsit_ni.json @@ -0,0 +1,75 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test NI Department for Business and Trade and Department for Science, Innovation and Technology", + "theme": "dbt-dsit-ni", + "description": "A questionnaire to demo the DBT-DSIT-NI survey theme", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "radio", + "question": { + "answers": [ + { + "id": "radio-answer", + "mandatory": false, + "options": [ + { + "label": "Bacon", + "value": "Bacon" + }, + { + "label": "Eggs", + "value": "Eggs" + }, + { + "label": "Sausage", + "value": "Sausage" + } + ], + "type": "Radio" + } + ], + "id": "radio-question", + "title": "What is your favourite breakfast food?", + "type": "General" + } + } + ], + "id": "group", + "title": "DBT-DSIT-NI Theme Test" + } + ] + } + ] +} diff --git a/schemas/test/en/test_theme_dbt_ni.json b/schemas/test/en/test_theme_dbt_ni.json new file mode 100644 index 0000000000..b8cf5716d0 --- /dev/null +++ b/schemas/test/en/test_theme_dbt_ni.json @@ -0,0 +1,75 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test NI Department for Business and Trade", + "theme": "dbt-ni", + "description": "A questionnaire to demo the DBT-NI survey theme", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "radio", + "question": { + "answers": [ + { + "id": "radio-answer", + "mandatory": false, + "options": [ + { + "label": "Bacon", + "value": "Bacon" + }, + { + "label": "Eggs", + "value": "Eggs" + }, + { + "label": "Sausage", + "value": "Sausage" + } + ], + "type": "Radio" + } + ], + "id": "radio-question", + "title": "What is your favourite breakfast food?", + "type": "General" + } + } + ], + "id": "group", + "title": "DBT-NI Theme Test" + } + ] + } + ] +} diff --git a/schemas/test/en/test_theme_desnz.json b/schemas/test/en/test_theme_desnz.json new file mode 100644 index 0000000000..c1aa83755f --- /dev/null +++ b/schemas/test/en/test_theme_desnz.json @@ -0,0 +1,75 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Department for Energy Security and Net Zero", + "theme": "desnz", + "description": "A questionnaire to demo the DESNZ survey theme", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "radio", + "question": { + "answers": [ + { + "id": "radio-answer", + "mandatory": false, + "options": [ + { + "label": "Bacon", + "value": "Bacon" + }, + { + "label": "Eggs", + "value": "Eggs" + }, + { + "label": "Sausage", + "value": "Sausage" + } + ], + "type": "Radio" + } + ], + "id": "radio-question", + "title": "What is your favourite breakfast food?", + "type": "General" + } + } + ], + "id": "group", + "title": "DESNZ Theme Test" + } + ] + } + ] +} diff --git a/schemas/test/en/test_theme_desnz_ni.json b/schemas/test/en/test_theme_desnz_ni.json new file mode 100644 index 0000000000..06751903f5 --- /dev/null +++ b/schemas/test/en/test_theme_desnz_ni.json @@ -0,0 +1,75 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test NI Department for Energy Security and Net Zero", + "theme": "desnz-ni", + "description": "A questionnaire to demo the DESNZ-NI survey theme", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "radio", + "question": { + "answers": [ + { + "id": "radio-answer", + "mandatory": false, + "options": [ + { + "label": "Bacon", + "value": "Bacon" + }, + { + "label": "Eggs", + "value": "Eggs" + }, + { + "label": "Sausage", + "value": "Sausage" + } + ], + "type": "Radio" + } + ], + "id": "radio-question", + "title": "What is your favourite breakfast food?", + "type": "General" + } + } + ], + "id": "group", + "title": "DESNZ-NI Theme Test" + } + ] + } + ] +} diff --git a/schemas/test/en/test_theme_health.json b/schemas/test/en/test_theme_health.json new file mode 100644 index 0000000000..e88814e7c6 --- /dev/null +++ b/schemas/test/en/test_theme_health.json @@ -0,0 +1,70 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Health Survey", + "theme": "health", + "description": "A questionnaire to demo the health survey theme", + "metadata": [ + { + "name": "qid", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "post_submission": { + "view_response": true + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "radio", + "question": { + "answers": [ + { + "id": "radio-answer", + "mandatory": false, + "options": [ + { + "label": "Bacon", + "value": "Bacon" + }, + { + "label": "Eggs", + "value": "Eggs" + }, + { + "label": "Sausage", + "value": "Sausage" + } + ], + "type": "Radio" + } + ], + "id": "radio-question", + "title": "What is your favourite breakfast food?", + "type": "General" + } + } + ], + "id": "group", + "title": "Health Theme Test" + } + ] + } + ] +} diff --git a/schemas/test/en/test_theme_northernireland.json b/schemas/test/en/test_theme_northernireland.json new file mode 100644 index 0000000000..569698acb7 --- /dev/null +++ b/schemas/test/en/test_theme_northernireland.json @@ -0,0 +1,75 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Northern Ireland Survey", + "theme": "northernireland", + "description": "A questionnaire to demo the northernireland survey theme", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "radio", + "question": { + "answers": [ + { + "id": "radio-answer", + "mandatory": false, + "options": [ + { + "label": "Bacon", + "value": "Bacon" + }, + { + "label": "Eggs", + "value": "Eggs" + }, + { + "label": "Sausage", + "value": "Sausage" + } + ], + "type": "Radio" + } + ], + "id": "radio-question", + "title": "What is your favourite breakfast food?", + "type": "General" + } + } + ], + "id": "group", + "title": "Northern Ireland Theme Test" + } + ] + } + ] +} diff --git a/schemas/test/en/test_theme_ons_nhs.json b/schemas/test/en/test_theme_ons_nhs.json new file mode 100644 index 0000000000..e733508d94 --- /dev/null +++ b/schemas/test/en/test_theme_ons_nhs.json @@ -0,0 +1,75 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test ONS NHS Survey", + "theme": "ons-nhs", + "description": "A questionnaire to demo the ons-nhs survey theme", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "radio", + "question": { + "answers": [ + { + "id": "radio-answer", + "mandatory": false, + "options": [ + { + "label": "Bacon", + "value": "Bacon" + }, + { + "label": "Eggs", + "value": "Eggs" + }, + { + "label": "Sausage", + "value": "Sausage" + } + ], + "type": "Radio" + } + ], + "id": "radio-question", + "title": "What is your favourite breakfast food?", + "type": "General" + } + } + ], + "id": "group", + "title": "ONS NHS Theme Test" + } + ] + } + ] +} diff --git a/schemas/test/en/test_theme_orr.json b/schemas/test/en/test_theme_orr.json new file mode 100644 index 0000000000..15aad627c3 --- /dev/null +++ b/schemas/test/en/test_theme_orr.json @@ -0,0 +1,75 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Rail and Road Survey", + "theme": "orr", + "description": "A questionnaire to demo the ORR survey theme", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "radio", + "question": { + "answers": [ + { + "id": "radio-answer", + "mandatory": false, + "options": [ + { + "label": "Bacon", + "value": "Bacon" + }, + { + "label": "Eggs", + "value": "Eggs" + }, + { + "label": "Sausage", + "value": "Sausage" + } + ], + "type": "Radio" + } + ], + "id": "radio-question", + "title": "What is your favourite breakfast food?", + "type": "General" + } + } + ], + "id": "group", + "title": "ORR Theme Test" + } + ] + } + ] +} diff --git a/schemas/test/en/test_theme_social.json b/schemas/test/en/test_theme_social.json new file mode 100644 index 0000000000..689a74f0b9 --- /dev/null +++ b/schemas/test/en/test_theme_social.json @@ -0,0 +1,71 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Social Survey", + "theme": "social", + "description": "A questionnaire to demo the social survey theme", + "metadata": [ + { + "name": "qid", + "type": "string" + } + ], + "post_submission": { + "view_response": true, + "feedback": true + }, + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "radio", + "question": { + "answers": [ + { + "id": "radio-answer", + "mandatory": false, + "options": [ + { + "label": "Bacon", + "value": "Bacon" + }, + { + "label": "Eggs", + "value": "Eggs" + }, + { + "label": "Sausage", + "value": "Sausage" + } + ], + "type": "Radio" + } + ], + "id": "radio-question", + "title": "What is your favourite breakfast food?", + "type": "General" + } + } + ], + "id": "group", + "title": "Social Theme Test" + } + ] + } + ] +} diff --git a/schemas/test/en/test_theme_ukhsa_ons.json b/schemas/test/en/test_theme_ukhsa_ons.json new file mode 100644 index 0000000000..9c72466d79 --- /dev/null +++ b/schemas/test/en/test_theme_ukhsa_ons.json @@ -0,0 +1,75 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test UKHSA ONS Survey", + "theme": "ukhsa-ons", + "description": "A questionnaire to demo the UKHSA ONS survey theme", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "radio", + "question": { + "answers": [ + { + "id": "radio-answer", + "mandatory": false, + "options": [ + { + "label": "Bacon", + "value": "Bacon" + }, + { + "label": "Eggs", + "value": "Eggs" + }, + { + "label": "Sausage", + "value": "Sausage" + } + ], + "type": "Radio" + } + ], + "id": "radio-question", + "title": "What is your favourite breakfast food?", + "type": "General" + } + } + ], + "id": "group", + "title": "UKHSA ONS Theme Test" + } + ] + } + ] +} diff --git a/schemas/test/en/test_timeout.json b/schemas/test/en/test_timeout.json new file mode 100644 index 0000000000..85e23ee42c --- /dev/null +++ b/schemas/test/en/test_timeout.json @@ -0,0 +1,63 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "session_timeout_in_seconds": 5, + "title": "Timeout test", + "theme": "default", + "description": "A questionnaire to test the timeout functionality in non JS integration test", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "timeout-group", + "title": "Timeout", + "blocks": [ + { + "type": "Question", + "id": "timeout-block", + "question": { + "answers": [ + { + "id": "timeout-answer", + "label": "Does the timeout appear?", + "mandatory": false, + "type": "TextField" + } + ], + "id": "timeout-question", + "title": "Timeout title", + "type": "General" + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_timeout_modal.json b/schemas/test/en/test_timeout_modal.json new file mode 100644 index 0000000000..8386c21947 --- /dev/null +++ b/schemas/test/en/test_timeout_modal.json @@ -0,0 +1,58 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "session_timeout_in_seconds": 125, + "title": "Timeout modal test", + "theme": "default", + "description": "A questionnaire to test the timeout modal functionality", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "timeout-group", + "title": "Timeout modal", + "blocks": [ + { + "id": "timeout-modal-interstitial", + "content": { + "title": "Timeout modal interstitial", + "contents": [ + { + "description": "Timeout modal will appear on this page after 65 seconds as the session timeout is set to 125 seconds, pressing “Continue survey” button on the modal will extend the session by that amount, “showModalTimeInSeconds” field is set to 60" + } + ] + }, + "type": "Interstitial" + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_title.json b/schemas/test/en/test_title.json new file mode 100644 index 0000000000..cb9c593307 --- /dev/null +++ b/schemas/test/en/test_title.json @@ -0,0 +1,70 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Question Title Test", + "theme": "default", + "description": "A questionnaire to test question titles", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "group", + "blocks": [ + { + "type": "Question", + "id": "single-title-block", + "question": { + "id": "single-title-question", + "title": "How are you feeling??", + "type": "General", + "answers": [ + { + "type": "Radio", + "id": "feeling-answer", + "mandatory": true, + "options": [ + { + "label": "Good", + "value": "Good" + }, + { + "label": "Bad", + "value": "Bad" + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_titles_radio_and_checkbox.json b/schemas/test/en/test_titles_radio_and_checkbox.json new file mode 100644 index 0000000000..e40074c8db --- /dev/null +++ b/schemas/test/en/test_titles_radio_and_checkbox.json @@ -0,0 +1,353 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Survey - Checkbox and Radio titles", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "radio-checkbox-group", + "blocks": [ + { + "id": "preamble-block", + "type": "Question", + "question": { + "id": "name-question", + "title": "What is your name?", + "type": "General", + "guidance": { + "contents": [ + { + "description": "The answer you write will have an effect on question titles in next question", + "list": [ + "If you type ‘Peter’, the question will be aimed for Peter", + "If you type ‘Mary’, the question will be aimed for Mary", + "If you type anything else the question will be the default question" + ] + } + ] + }, + "answers": [ + { + "id": "name-answer", + "label": "Your name", + "type": "TextField", + "mandatory": true + } + ] + } + }, + { + "type": "Question", + "id": "checkbox-block", + "question_variants": [ + { + "when": { + "==": [ + { + "source": "answers", + "identifier": "name-answer" + }, + "Peter" + ] + }, + "question": { + "id": "checkbox-question", + "type": "General", + "title": "Did Peter make changes to this business?", + "answers": [ + { + "id": "checkbox-answer", + "type": "Checkbox", + "mandatory": true, + "options": [ + { + "label": "New business practices for organising procedures", + "value": "New business practices for organising procedures" + }, + { + "label": "New methods of organising work responsibilities and decision making", + "value": "New methods of organising work responsibilities and decision making" + }, + { + "label": "New methods of organising external relationships with other firms or public institutions", + "value": "New methods of organising external relationships with other firms or public institutions" + }, + { + "label": "Implementation of changes to marketing concepts or strategies", + "value": "Implementation of changes to marketing concepts or strategies" + } + ] + } + ] + } + }, + { + "when": { + "==": [ + { + "source": "answers", + "identifier": "name-answer" + }, + "Mary" + ] + }, + "question": { + "id": "checkbox-question", + "type": "General", + "title": "Did Mary make changes to this business?", + "answers": [ + { + "id": "checkbox-answer", + "type": "Checkbox", + "mandatory": true, + "options": [ + { + "label": "New business practices for organising procedures", + "value": "New business practices for organising procedures" + }, + { + "label": "New methods of organising work responsibilities and decision making", + "value": "New methods of organising work responsibilities and decision making" + }, + { + "label": "New methods of organising external relationships with other firms or public institutions", + "value": "New methods of organising external relationships with other firms or public institutions" + }, + { + "label": "Implementation of changes to marketing concepts or strategies", + "value": "Implementation of changes to marketing concepts or strategies" + } + ] + } + ] + } + }, + { + "when": { + "!=": [ + { + "source": "answers", + "identifier": "name-answer" + }, + "Mary" + ] + }, + "question": { + "id": "checkbox-question", + "type": "General", + "title": "Did this business make major changes in the following areas?", + "answers": [ + { + "id": "checkbox-answer", + "type": "Checkbox", + "mandatory": true, + "options": [ + { + "label": "New business practices for organising procedures", + "value": "New business practices for organising procedures" + }, + { + "label": "New methods of organising work responsibilities and decision making", + "value": "New methods of organising work responsibilities and decision making" + }, + { + "label": "New methods of organising external relationships with other firms or public institutions", + "value": "New methods of organising external relationships with other firms or public institutions" + }, + { + "label": "Implementation of changes to marketing concepts or strategies", + "value": "Implementation of changes to marketing concepts or strategies" + } + ] + } + ] + } + } + ] + }, + { + "type": "Question", + "id": "radio-block", + "question_variants": [ + { + "when": { + "==": [ + { + "source": "answers", + "identifier": "name-answer" + }, + "Peter" + ] + }, + "question": { + "id": "radio-question", + "type": "General", + "title": "Is Peter the boss?", + "answers": [ + { + "id": "radio-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + }, + { + "label": "Maybe", + "value": "Maybe" + }, + { + "label": "I don’t know", + "value": "I don’t know" + }, + { + "label": "Can you repeat the question", + "value": "Can you repeat the question" + } + ] + } + ] + } + }, + { + "when": { + "==": [ + { + "source": "answers", + "identifier": "name-answer" + }, + "Mary" + ] + }, + "question": { + "id": "radio-question", + "type": "General", + "title": "Is Mary the boss?", + "answers": [ + { + "id": "radio-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + }, + { + "label": "Maybe", + "value": "Maybe" + }, + { + "label": "I don’t know", + "value": "I don’t know" + }, + { + "label": "Can you repeat the question", + "value": "Can you repeat the question" + } + ] + } + ] + } + }, + { + "when": { + "!=": [ + { + "source": "answers", + "identifier": "name-answer" + }, + "Mary" + ] + }, + "question": { + "id": "radio-question", + "type": "General", + "title": { + "text": "Is {name} the boss?", + "placeholders": [ + { + "placeholder": "name", + "value": { + "source": "answers", + "identifier": "name-answer" + } + } + ] + }, + "answers": [ + { + "id": "radio-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + }, + { + "label": "Maybe", + "value": "Maybe" + }, + { + "label": "I don’t know", + "value": "I don’t know" + }, + { + "label": "Can you repeat the question", + "value": "Can you repeat the question" + } + ] + } + ] + } + } + ] + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_unit_patterns.json b/schemas/test/en/test_unit_patterns.json new file mode 100644 index 0000000000..d795d95653 --- /dev/null +++ b/schemas/test/en/test_unit_patterns.json @@ -0,0 +1,277 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "999", + "title": "Test Unit Patterns", + "description": "Tests for localised (UK rendering) measurements.", + "theme": "default", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "set-length-units-block", + "question": { + "answers": [ + { + "id": "centimetres", + "label": "Length in Centimetres", + "mandatory": false, + "type": "Unit", + "unit": "length-centimeter", + "unit_length": "short", + "maximum": { + "value": 1000 + } + }, + { + "id": "metres", + "label": "Length in Metres", + "mandatory": false, + "type": "Unit", + "unit": "length-meter", + "unit_length": "short", + "maximum": { + "value": 1000 + } + }, + { + "id": "kilometres", + "label": "Length in Kilometres", + "mandatory": false, + "type": "Unit", + "unit": "length-kilometer", + "unit_length": "short", + "maximum": { + "value": 1000 + } + }, + { + "id": "miles", + "label": "Length in Miles", + "mandatory": false, + "type": "Unit", + "unit": "length-mile", + "unit_length": "short", + "maximum": { + "value": 1000 + } + }, + { + "id": "min-max-miles", + "label": "Length in Miles - Min Max Range", + "mandatory": false, + "type": "Unit", + "unit": "length-mile", + "unit_length": "short", + "minimum": { + "value": -99999999999999 + } + } + ], + "id": "set-length-units-question", + "title": "Length Units", + "type": "General" + } + }, + { + "type": "Question", + "id": "set-duration-units-block", + "question": { + "answers": [ + { + "id": "duration-hour", + "label": "Hour", + "mandatory": false, + "type": "Unit", + "unit": "duration-hour", + "unit_length": "long", + "maximum": { + "value": 99 + } + }, + { + "id": "duration-year", + "label": "Years", + "mandatory": false, + "type": "Unit", + "unit": "duration-year", + "unit_length": "long", + "maximum": { + "value": 99 + } + } + ], + "id": "set-duration-units-question", + "title": "Duration Units", + "type": "General" + } + }, + { + "type": "Question", + "id": "set-area-units-block", + "question": { + "answers": [ + { + "id": "square-centimetres", + "label": "Centimetres Square", + "mandatory": false, + "type": "Unit", + "unit": "area-square-centimeter", + "unit_length": "short" + }, + { + "id": "square-metres", + "label": "Metres Square", + "mandatory": false, + "type": "Unit", + "unit": "area-square-meter", + "unit_length": "short" + }, + { + "id": "square-kilometres", + "label": "Kilometres Square", + "mandatory": false, + "type": "Unit", + "unit": "area-square-kilometer", + "unit_length": "short" + }, + { + "id": "square-miles", + "label": "Miles Square", + "mandatory": false, + "type": "Unit", + "unit": "area-square-mile", + "unit_length": "short" + }, + { + "id": "acres", + "label": "Acres", + "mandatory": false, + "type": "Unit", + "unit": "area-acre", + "unit_length": "short" + }, + { + "id": "hectares", + "label": "Hectares", + "mandatory": false, + "type": "Unit", + "unit": "area-hectare", + "unit_length": "short" + } + ], + "id": "set-area-unit-questions", + "title": "Area Units", + "type": "General" + } + }, + { + "type": "Question", + "id": "set-volume-units-block", + "question": { + "answers": [ + { + "id": "cubic-centimetres", + "label": "Cubic Centimetres", + "mandatory": false, + "type": "Unit", + "unit": "volume-cubic-centimeter", + "unit_length": "short", + "decimal_places": 6 + }, + { + "id": "cubic-metres", + "label": "Cubic Metres", + "mandatory": false, + "type": "Unit", + "unit": "volume-cubic-meter", + "unit_length": "short", + "decimal_places": 6 + }, + { + "id": "litres", + "label": "Litres", + "mandatory": false, + "type": "Unit", + "unit": "volume-liter", + "unit_length": "short", + "decimal_places": 6 + }, + { + "id": "hectolitres", + "label": "Hectolitres", + "mandatory": false, + "type": "Unit", + "unit": "volume-hectoliter", + "unit_length": "short", + "decimal_places": 6 + }, + { + "id": "megalitres", + "label": "Megalitres", + "mandatory": false, + "type": "Unit", + "unit": "volume-megaliter", + "unit_length": "short", + "decimal_places": 6 + } + ], + "id": "set-volume-unit-questions", + "title": "Volume Units", + "type": "General" + } + }, + { + "type": "Question", + "id": "set-weight-units-block", + "question": { + "answers": [ + { + "id": "mass-tonne", + "label": "Mass tonnes", + "mandatory": false, + "type": "Unit", + "unit": "mass-tonne", + "unit_length": "short" + } + ], + "id": "set-weight-unit-questions", + "title": "Weight Units", + "type": "General" + } + } + ], + "id": "test" + } + ] + } + ] +} diff --git a/schemas/test/en/test_validation_sum_against_total_dynamic_answers.json b/schemas/test/en/test_validation_sum_against_total_dynamic_answers.json new file mode 100644 index 0000000000..b2ec85409f --- /dev/null +++ b/schemas/test/en/test_validation_sum_against_total_dynamic_answers.json @@ -0,0 +1,470 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "A test schema to validate a sum of dynamic answers are equal to a given total", + "theme": "default", + "description": "A survey that tests calculated answers against a total", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + + "questionnaire_flow": { + "type": "Hub", + "options": { + "required_completed_sections": ["total-section"] + } + }, + "sections": [ + { + "id": "total-section", + "title": "Total", + "groups": [ + { + "blocks": [ + { + "type": "Question", + "id": "total-block", + "question": { + "guidance": { + "contents": [ + { + "description": "Answer will be used for validation in the next section." + } + ] + }, + "id": "total-question", + "title": "What percentage of your shopping do you do at supermarkets?", + "type": "General", + "answers": [ + { + "id": "total-answer", + "label": "Total", + "mandatory": true, + "type": "Percentage", + "maximum": { + "value": 100 + }, + "decimal_places": 0 + } + ] + } + } + ], + "id": "total-group" + } + ] + }, + { + "id": "dynamic-answers-section", + "title": "Supermarkets", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "supermarkets", + "title": "Household members", + "add_link_text": "Add another supermarket", + "empty_list_text": "There are no supermarkets" + } + ], + "show_non_item_answers": true + }, + "groups": [ + { + "id": "group", + "blocks": [ + { + "type": "ListCollectorDrivingQuestion", + "id": "any-supermarket", + "for_list": "supermarkets", + "question": { + "type": "General", + "id": "any-supermarket-question", + "title": "Do you need to add any supermarkets?", + "answers": [ + { + "type": "Radio", + "id": "any-supermarket-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock", + "params": { + "block_id": "add-supermarket", + "list_name": "supermarkets" + } + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "routing_rules": [ + { + "section": "End", + "when": { + "==": [ + { + "source": "answers", + "identifier": "any-supermarket-answer" + }, + "No" + ] + } + }, + { + "block": "list-collector" + } + ] + }, + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "supermarkets", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Do you need to add any more supermarkets?", + "answers": [ + { + "id": "list-collector-answer", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-supermarket", + "type": "ListAddQuestion", + "cancel_text": "Don’t need to add any other supermarkets?", + "question": { + "guidance": { + "contents": [ + { + "description": "Maximum spending value will be used for each supermarket’s max spending validation and placeholders." + } + ] + }, + "id": "add-question", + "type": "General", + "title": "Which supermarkets do you use for your weekly shopping?", + "answers": [ + { + "id": "supermarket-name", + "label": "Supermarket", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-supermarket", + "type": "ListEditQuestion", + "cancel_text": "Don’t need to change anything?", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the supermarket?", + "answers": [ + { + "id": "supermarket-name", + "label": "Supermarket", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-supermarket", + "type": "ListRemoveQuestion", + "cancel_text": "Don’t need to remove this supermarket?", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this supermarket?", + "warning": "All of the information about this supermarket will be deleted", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Supermarkets", + "item_title": { + "text": "{supermarket_name}", + "placeholders": [ + { + "placeholder": "supermarket_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "supermarket-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + }, + { + "type": "Question", + "id": "dynamic-answer", + "skip_conditions": { + "when": { + "==": [ + { + "count": [ + { + "source": "list", + "identifier": "supermarkets" + } + ] + }, + 0 + ] + } + }, + "question": { + "guidance": { + "contents": [ + { + "description": "Answers are validated against total percentage from previous section." + } + ] + }, + "dynamic_answers": { + "values": { + "source": "list", + "identifier": "supermarkets" + }, + "answers": [ + { + "label": { + "text": "Percentage of shopping at {transformed_value}", + "placeholders": [ + { + "placeholder": "transformed_value", + "value": { + "source": "answers", + "identifier": "supermarket-name" + } + } + ] + }, + "id": "percentage-of-shopping", + "mandatory": false, + "type": "Percentage", + "maximum": { + "value": 100 + }, + "decimal_places": 0 + } + ] + }, + "answers": [ + { + "label": { + "text": "Percentage of shopping elsewhere", + "placeholders": [ + { + "placeholder": "transformed_value", + "value": { + "source": "answers", + "identifier": "supermarket-name" + } + } + ] + }, + "id": "percentage-of-shopping-elsewhere", + "mandatory": false, + "type": "Percentage", + "maximum": { + "value": 100 + }, + "decimal_places": 0 + } + ], + "warning": "These answers must add up to the total provided in the previous section", + "calculations": [ + { + "calculation_type": "sum", + "answer_id": "total-answer", + "answers_to_calculate": ["percentage-of-shopping-elsewhere", "percentage-of-shopping"], + "conditions": ["equals"] + } + ], + "id": "dynamic-answer-question", + "title": "What percent of your shopping do you do at each of the following supermarket?", + "type": "Calculated" + } + }, + { + "type": "Question", + "id": "total-block-other", + "question": { + "guidance": { + "contents": [ + { + "description": "Answer will be used for validation in the next question." + } + ] + }, + "id": "total-question-other", + "title": "Total amount you spend", + "type": "General", + "answers": [ + { + "id": "total-answer-other", + "label": "Total", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "dynamic-answer-only", + "skip_conditions": { + "when": { + "==": [ + { + "count": [ + { + "source": "list", + "identifier": "supermarkets" + } + ] + }, + 0 + ] + } + }, + "question": { + "guidance": { + "contents": [ + { + "description": "Answers are validated against total amount from previous question." + } + ] + }, + "dynamic_answers": { + "values": { + "source": "list", + "identifier": "supermarkets" + }, + "answers": [ + { + "label": { + "text": "How much do you spend at {transformed_value}", + "placeholders": [ + { + "placeholder": "transformed_value", + "value": { + "source": "answers", + "identifier": "supermarket-name" + } + } + ] + }, + "id": "spending-amount", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "maximum": { + "value": { + "source": "answers", + "identifier": "total-answer-other" + } + }, + "minimum": { + "value": 0 + } + } + ] + }, + "warning": "These answers must add up to the total provided in the previous question", + "calculations": [ + { + "calculation_type": "sum", + "answer_id": "total-answer-other", + "answers_to_calculate": ["spending-amount"], + "conditions": ["equals"] + } + ], + "id": "dynamic-answer-only-question", + "title": "How much do you spend at each of the following supermarket?", + "type": "Calculated" + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_validation_sum_against_total_equal.json b/schemas/test/en/test_validation_sum_against_total_equal.json new file mode 100644 index 0000000000..5ec8e0e3fa --- /dev/null +++ b/schemas/test/en/test_validation_sum_against_total_equal.json @@ -0,0 +1,111 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "A test schema to validate a sum of answers are Equal to a given total", + "theme": "default", + "description": "A survey that tests grouped and calculated answers against a total", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "group", + "title": "Validate sum against total", + "blocks": [ + { + "type": "Question", + "id": "total-block", + "question": { + "id": "total-question", + "title": "Total", + "type": "General", + "answers": [ + { + "id": "total-answer", + "label": "Total", + "mandatory": true, + "type": "Number", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "breakdown-block", + "question": { + "id": "breakdown-question", + "title": "Breakdown", + "type": "Calculated", + "warning": "These answers must add up to the total provided in the previous question", + "calculations": [ + { + "calculation_type": "sum", + "answer_id": "total-answer", + "answers_to_calculate": ["breakdown-1", "breakdown-2", "breakdown-3", "breakdown-4"], + "conditions": ["equals"] + } + ], + "answers": [ + { + "id": "breakdown-1", + "label": "Breakdown 1", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + }, + { + "id": "breakdown-2", + "label": "Breakdown 2", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + }, + { + "id": "breakdown-3", + "label": "Breakdown 3", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + }, + { + "id": "breakdown-4", + "label": "Breakdown 4", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_validation_sum_against_total_equal_or_less_than.json b/schemas/test/en/test_validation_sum_against_total_equal_or_less_than.json new file mode 100644 index 0000000000..2e33832bdd --- /dev/null +++ b/schemas/test/en/test_validation_sum_against_total_equal_or_less_than.json @@ -0,0 +1,110 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "A test schema to validate a sum of answers are Less Than or Equal to a given total", + "theme": "default", + "description": "A survey that tests grouped and calculated answers against a total", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "group", + "title": "Validate sum against total", + "blocks": [ + { + "type": "Question", + "id": "total-block", + "question": { + "id": "total-question", + "title": "Total", + "type": "General", + "answers": [ + { + "id": "total-answer", + "label": "Total", + "mandatory": true, + "type": "Number", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "breakdown-block", + "question": { + "id": "breakdown-question", + "title": "Breakdown", + "type": "Calculated", + "calculations": [ + { + "calculation_type": "sum", + "answer_id": "total-answer", + "answers_to_calculate": ["breakdown-1", "breakdown-2", "breakdown-3", "breakdown-4"], + "conditions": ["less than", "equals"] + } + ], + "answers": [ + { + "id": "breakdown-1", + "label": "Breakdown 1", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + }, + { + "id": "breakdown-2", + "label": "Breakdown 2", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + }, + { + "id": "breakdown-3", + "label": "Breakdown 3", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + }, + { + "id": "breakdown-4", + "label": "Breakdown 4", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_validation_sum_against_total_hub_with_dependent_section.json b/schemas/test/en/test_validation_sum_against_total_hub_with_dependent_section.json new file mode 100644 index 0000000000..7001c9d763 --- /dev/null +++ b/schemas/test/en/test_validation_sum_against_total_hub_with_dependent_section.json @@ -0,0 +1,252 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Calculated Question - Total In Separate Section (Hub)", + "theme": "default", + "description": "A questionnaire to test calculated question with total in a separate section using the Hub", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { "required_completed_sections": ["company-overview-section"] } + }, + "sections": [ + { + "id": "company-overview-section", + "title": "Overview", + "summary": { + "show_on_completion": true + }, + "groups": [ + { + "id": "company-overview-group", + "title": "Turnover & Employees", + "blocks": [ + { + "type": "Question", + "id": "total-turnover-block", + "question": { + "id": "total-turnover-question", + "title": "What was your total turnover for 2021?", + "type": "General", + "answers": [ + { + "id": "total-turnover-answer", + "label": "Total turnover", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "minimum": { + "value": 0, + "exclusive": true + } + } + ] + } + }, + { + "type": "Question", + "id": "total-employees-block", + + "question": { + "id": "total-employees-question", + "title": { + "text": "On 1st Jan 2021, what was the number of employees for {ru_name}?", + "placeholders": [ + { + "placeholder": "ru_name", + "value": { + "source": "metadata", + "identifier": "ru_name" + } + } + ] + }, + "type": "General", + "answers": [ + { + "id": "total-employees-answer", + "label": "Total employees", + "mandatory": true, + "type": "Number", + "minimum": { + "value": 0, + "exclusive": true + } + } + ] + } + } + ] + } + ] + }, + { + "id": "breakdown-section", + "title": "Breakdown", + "summary": { + "show_on_completion": true + }, + "enabled": { + "when": { + "and": [ + { + "!=": [ + null, + { + "source": "answers", + "identifier": "total-turnover-answer" + } + ] + }, + { + "!=": [ + null, + { + "source": "answers", + "identifier": "total-employees-answer" + } + ] + } + ] + } + }, + "groups": [ + { + "id": "breakdown-group", + "title": "Company breakdown", + "blocks": [ + { + "type": "Question", + "id": "turnover-breakdown-block", + "question": { + "id": "turnover-breakdown-question", + "title": { + "text": "Please breakdown your total turnover of {total_turnover}", + "placeholders": [ + { + "placeholder": "total_turnover", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "source": "answers", + "identifier": "total-turnover-answer" + } + } + } + ] + } + ] + }, + "type": "Calculated", + "warning": "These answers must add up to the total turnover provided in the first section", + "calculations": [ + { + "calculation_type": "sum", + "answer_id": "total-turnover-answer", + "answers_to_calculate": ["turnover-breakdown-1", "turnover-breakdown-2", "turnover-breakdown-3"], + "conditions": ["equals"] + } + ], + "answers": [ + { + "id": "turnover-breakdown-1", + "label": "Cost of sales", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "turnover-breakdown-2", + "label": "Operating expenses", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "turnover-breakdown-3", + "label": "Gross profit", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "employees-breakdown-block", + "question": { + "id": "employees-breakdown-question", + "title": { + "text": "Please breakdown your number of employees of {total_employees}", + "placeholders": [ + { + "placeholder": "total_employees", + "transforms": [ + { + "transform": "format_number", + "arguments": { + "number": { + "source": "answers", + "identifier": "total-employees-answer" + } + } + } + ] + } + ] + }, + "type": "Calculated", + "warning": "These answers must add up to the total employees provided in the first section", + "calculations": [ + { + "calculation_type": "sum", + "answer_id": "total-employees-answer", + "answers_to_calculate": ["employees-breakdown-1", "employees-breakdown-2"], + "conditions": ["equals"] + } + ], + "answers": [ + { + "id": "employees-breakdown-1", + "label": "Male employees", + "mandatory": false, + "type": "Number" + }, + { + "id": "employees-breakdown-2", + "label": "Female employees", + "mandatory": false, + "type": "Number" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_validation_sum_against_total_less_than.json b/schemas/test/en/test_validation_sum_against_total_less_than.json new file mode 100644 index 0000000000..a6bf249ff9 --- /dev/null +++ b/schemas/test/en/test_validation_sum_against_total_less_than.json @@ -0,0 +1,115 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "A test schema to validate a sum of answers are Less Than a given total", + "theme": "default", + "description": "A survey that tests grouped and calculated answers against a total", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "group", + "title": "Validate sum against total", + "blocks": [ + { + "type": "Question", + "id": "total-block", + "question": { + "id": "total-question", + "title": "Total", + "type": "General", + "answers": [ + { + "id": "total-answer", + "label": "Total", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "breakdown-block", + "question": { + "id": "breakdown-question", + "title": "Breakdown", + "type": "Calculated", + "calculations": [ + { + "calculation_type": "sum", + "answer_id": "total-answer", + "answers_to_calculate": ["breakdown-1", "breakdown-2", "breakdown-3", "breakdown-4"], + "conditions": ["less than"] + } + ], + "answers": [ + { + "id": "breakdown-1", + "label": "Breakdown 1", + "mandatory": false, + "decimal_places": 2, + "type": "Currency", + "currency": "GBP" + }, + { + "id": "breakdown-2", + "label": "Breakdown 2", + "mandatory": false, + "decimal_places": 2, + "type": "Currency", + "currency": "GBP" + }, + { + "id": "breakdown-3", + "label": "Breakdown 3", + "mandatory": false, + "decimal_places": 2, + "type": "Currency", + "currency": "GBP" + }, + { + "id": "breakdown-4", + "label": "Breakdown 4", + "mandatory": false, + "decimal_places": 2, + "type": "Currency", + "currency": "GBP" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_validation_sum_against_total_multiple.json b/schemas/test/en/test_validation_sum_against_total_multiple.json new file mode 100644 index 0000000000..285d240284 --- /dev/null +++ b/schemas/test/en/test_validation_sum_against_total_multiple.json @@ -0,0 +1,120 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Grouped validation against total test survey", + "theme": "default", + "description": "A survey that tests grouped and calculated answers against a total", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "group", + "title": "Validate sum against total", + "blocks": [ + { + "type": "Question", + "id": "total-block", + "question": { + "id": "total-question", + "title": "Total", + "type": "General", + "answers": [ + { + "id": "total-answer", + "label": "Total", + "mandatory": true, + "type": "Number", + "decimal_places": 2, + "minimum": { + "value": 0, + "exclusive": true + } + } + ] + } + }, + { + "type": "Question", + "id": "breakdown-block", + "question": { + "id": "breakdown-question", + "title": "Breakdown", + "type": "Calculated", + "calculations": [ + { + "calculation_type": "sum", + "value": 0, + "answers_to_calculate": ["breakdown-1", "breakdown-2", "breakdown-3", "breakdown-4"], + "conditions": ["equals"] + }, + { + "calculation_type": "sum", + "answer_id": "total-answer", + "answers_to_calculate": ["breakdown-1", "breakdown-2", "breakdown-3", "breakdown-4"], + "conditions": ["equals"] + } + ], + "answers": [ + { + "id": "breakdown-1", + "label": "Breakdown 1", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + }, + { + "id": "breakdown-2", + "label": "Breakdown 2", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + }, + { + "id": "breakdown-3", + "label": "Breakdown 3", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + }, + { + "id": "breakdown-4", + "label": "Breakdown 4", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_validation_sum_against_total_repeating_with_dependent_section.json b/schemas/test/en/test_validation_sum_against_total_repeating_with_dependent_section.json new file mode 100644 index 0000000000..faa5d77f3f --- /dev/null +++ b/schemas/test/en/test_validation_sum_against_total_repeating_with_dependent_section.json @@ -0,0 +1,506 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test Calculated Question - Repeating section", + "theme": "default", + "description": "A questionnaire to test repeating calculated question with total in a separate section using the Hub", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": { "required_completed_sections": ["householders-section", "household-overview-section"] } + }, + "sections": [ + { + "id": "householders-section", + "title": "Householders", + "summary": { + "show_on_completion": true, + "items": [ + { + "type": "List", + "for_list": "people", + "title": "Household members", + "add_link_text": "Add someone to this household", + "empty_list_text": "There are no householders" + } + ] + }, + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "cancel_text": "Don’t need to add anyone else?", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "cancel_text": "Don’t need to change anything?", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "cancel_text": "Don’t need to remove this person?", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "warning": "All of the information about this person will be deleted", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "household-overview-section", + "title": "Household Overview", + "summary": { + "show_on_completion": true + }, + "enabled": { + "when": { + ">": [ + { + "count": [ + { + "source": "list", + "identifier": "people" + } + ] + }, + 0 + ] + } + }, + "groups": [ + { + "id": "household-overview-group", + "title": "Spending", + "blocks": [ + { + "type": "Question", + "id": "total-spending-block", + "question": { + "id": "total-spending-question", + "title": "What is the maximum spending limit for a household member per month (excluding entertainment)?", + "type": "General", + "answers": [ + { + "id": "total-spending-answer", + "label": "Maximum spending", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "minimum": { + "value": 0, + "exclusive": true + } + } + ] + } + }, + { + "type": "Question", + "id": "entertainment-spending-block", + "question": { + "id": "entertainment-spending-question", + "title": "What is the maximum spending limit on entertainment for a household member per month?", + "type": "General", + "answers": [ + { + "id": "entertainment-spending-answer", + "label": "Entertaintment spending", + "mandatory": true, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2, + "minimum": { + "value": 0, + "exclusive": true + } + } + ] + } + } + ] + } + ] + }, + { + "id": "breakdown-section", + "title": "Breakdown", + "summary": { + "show_on_completion": true + }, + "repeat": { + "for_list": "people", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "enabled": { + "when": { + "!=": [ + null, + { + "source": "answers", + "identifier": "total-spending-answer" + } + ] + } + }, + "groups": [ + { + "id": "breakdown-group", + "title": "Household breakdown", + "blocks": [ + { + "id": "breakdown-driving-block", + "question": { + "title": "Would you like to answer a question about your monthly spending?", + "answers": [ + { + "id": "breakdown-driving-answer", + "mandatory": true, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "breakdown-driving-question", + "type": "General" + }, + "type": "Question", + "routing_rules": [ + { + "when": { + "==": [ + { + "source": "answers", + "identifier": "breakdown-driving-answer" + }, + "Yes" + ] + }, + "block": "spending-breakdown-block" + }, + { + "section": "End" + } + ] + }, + { + "type": "Question", + "id": "spending-breakdown-block", + "question": { + "id": "spending-breakdown-question", + "title": { + "text": "How do you spending the monthly budget of {total_spending}?", + "placeholders": [ + { + "placeholder": "total_spending", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "source": "answers", + "identifier": "total-spending-answer" + } + } + } + ] + } + ] + }, + "type": "Calculated", + "warning": "These answers must add up to the total spending limit provided in the first section", + "calculations": [ + { + "calculation_type": "sum", + "answer_id": "total-spending-answer", + "answers_to_calculate": ["spending-breakdown-1", "spending-breakdown-2", "spending-breakdown-3"], + "conditions": ["equals"] + } + ], + "answers": [ + { + "id": "spending-breakdown-1", + "label": "Housing", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "spending-breakdown-2", + "label": "Transportation", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "spending-breakdown-3", + "label": "Loans", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + }, + { + "type": "Question", + "id": "second-spending-breakdown-block", + "question": { + "id": "second-spending-breakdown-question", + "title": { + "text": "How do you spend the monthly entertainment budget of {entertainment}?", + "placeholders": [ + { + "placeholder": "entertainment", + "transforms": [ + { + "transform": "format_currency", + "arguments": { + "number": { + "source": "answers", + "identifier": "entertainment-spending-answer" + } + } + } + ] + } + ] + }, + "type": "Calculated", + "warning": "These answers must add up to the entertainment budget provided in the spending breakdown question", + "calculations": [ + { + "calculation_type": "sum", + "value": { + "source": "answers", + "identifier": "entertainment-spending-answer" + }, + "answers_to_calculate": [ + "second-spending-breakdown-1", + "second-spending-breakdown-2", + "second-spending-breakdown-3", + "second-spending-breakdown-4" + ], + "conditions": ["equals"] + } + ], + "answers": [ + { + "id": "second-spending-breakdown-1", + "label": "Cinema", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "second-spending-breakdown-2", + "label": "Concerts", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "second-spending-breakdown-3", + "label": "Sporting events", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + }, + { + "id": "second-spending-breakdown-4", + "label": "Other", + "mandatory": false, + "type": "Currency", + "currency": "GBP", + "decimal_places": 2 + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_validation_sum_against_value_source.json b/schemas/test/en/test_validation_sum_against_value_source.json new file mode 100644 index 0000000000..b394a70198 --- /dev/null +++ b/schemas/test/en/test_validation_sum_against_value_source.json @@ -0,0 +1,190 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Calculated question with value sources test survey", + "theme": "default", + "description": "A survey that tests validation against value sources", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "default-section", + "groups": [ + { + "id": "group", + "title": "Validate sum against answer, calculated summary source", + "blocks": [ + { + "type": "Question", + "id": "total-block", + "question": { + "id": "total-question", + "title": "Total", + "description": ["Enter a number to breakdown in subsequent questions and calculated summary."], + "type": "General", + "answers": [ + { + "id": "total-answer", + "label": "Total", + "mandatory": true, + "type": "Number", + "decimal_places": 2, + "minimum": { + "value": 0, + "exclusive": true + } + } + ] + } + }, + { + "type": "Question", + "id": "breakdown-block", + "question": { + "id": "breakdown-question", + "title": "Breakdown validated against an answer value source", + "description": ["This is a breakdown of the total number from the previous question."], + "type": "Calculated", + "calculations": [ + { + "calculation_type": "sum", + "value": { + "source": "answers", + "identifier": "total-answer" + }, + "answers_to_calculate": ["breakdown-1", "breakdown-2", "breakdown-3", "breakdown-4"], + "conditions": ["equals"] + } + ], + "answers": [ + { + "id": "breakdown-1", + "label": "Breakdown 1", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + }, + { + "id": "breakdown-2", + "label": "Breakdown 2", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + }, + { + "id": "breakdown-3", + "label": "Breakdown 3", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + }, + { + "id": "breakdown-4", + "label": "Breakdown 4", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "number-total-playback", + "title": "We calculate the total of number values entered to be %(total)s. Is this correct?", + "calculation": { + "calculation_type": "sum", + "answers_to_calculate": ["breakdown-1", "breakdown-2"], + "title": "Grand total of previous values" + } + }, + { + "type": "Question", + "id": "second-breakdown-block", + "question": { + "id": "second-breakdown-question", + "title": "Breakdown validated against calculated summary value source", + "description": ["This is a breakdown of the grand total from the previous calculated summary."], + "type": "Calculated", + "calculations": [ + { + "calculation_type": "sum", + "value": { + "source": "calculated_summary", + "identifier": "number-total-playback" + }, + "answers_to_calculate": ["second-breakdown-1", "second-breakdown-2", "second-breakdown-3", "second-breakdown-4"], + "conditions": ["equals"] + } + ], + "answers": [ + { + "id": "second-breakdown-1", + "label": "Breakdown 1", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + }, + { + "id": "second-breakdown-2", + "label": "Breakdown 2", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + }, + { + "id": "second-breakdown-3", + "label": "Breakdown 3", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + }, + { + "id": "second-breakdown-4", + "label": "Breakdown 4", + "mandatory": false, + "decimal_places": 2, + "type": "Number" + } + ] + } + }, + { + "type": "CalculatedSummary", + "id": "another-number-total-playback", + "title": "We calculate the total of number values entered to be %(total)s. Is this correct?", + "calculation": { + "calculation_type": "sum", + "answers_to_calculate": ["breakdown-1", "breakdown-2", "breakdown-3", "breakdown-4"], + "title": "Another grand total of previous values" + } + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_variants_content.json b/schemas/test/en/test_variants_content.json new file mode 100644 index 0000000000..ccec714151 --- /dev/null +++ b/schemas/test/en/test_variants_content.json @@ -0,0 +1,106 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test New Content Variants", + "theme": "default", + "description": "A questionnaire to test new content variants and variant choices", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Linear", + "options": { + "summary": { + "collapsible": false + } + } + }, + "sections": [ + { + "id": "section", + "groups": [ + { + "id": "group", + "title": "Variants", + "blocks": [ + { + "type": "Question", + "id": "age-question-block", + "question": { + "id": "age-question", + "type": "General", + "title": "What is your age?", + "answers": [ + { + "id": "age-answer", + "label": "Your age?", + "mandatory": true, + "type": "Number" + } + ] + } + }, + { + "type": "Interstitial", + "id": "age-display-block", + "content_variants": [ + { + "content": { + "title": "You are 16 or older", + "contents": [ + { + "description": "According to your answer" + } + ] + }, + "when": { + ">": [ + { + "source": "answers", + "identifier": "age-answer" + }, + 16 + ] + } + }, + { + "content": { + "title": "You are 16 or younger", + "contents": [ + { + "description": "According to your answer" + } + ] + }, + "when": { + "<=": [ + { + "source": "answers", + "identifier": "age-answer" + }, + 16 + ] + } + } + ] + } + ] + } + ] + } + ] +} diff --git a/schemas/test/en/test_variants_first_item_in_list.json b/schemas/test/en/test_variants_first_item_in_list.json new file mode 100644 index 0000000000..0e3f8f366f --- /dev/null +++ b/schemas/test/en/test_variants_first_item_in_list.json @@ -0,0 +1,298 @@ +{ + "mime_type": "application/json/ons/eq", + "language": "en", + "schema_version": "0.0.1", + "data_version": "0.0.3", + "survey_id": "0", + "title": "Test New Question Variants Using List", + "theme": "default", + "description": "A questionnaire to test new question variants using the first item in a list", + "metadata": [ + { + "name": "user_id", + "type": "string" + }, + { + "name": "period_id", + "type": "string" + }, + { + "name": "ru_name", + "type": "string" + } + ], + "questionnaire_flow": { + "type": "Hub", + "options": {} + }, + "sections": [ + { + "id": "section", + "title": "Household", + "groups": [ + { + "id": "group", + "title": "List", + "blocks": [ + { + "id": "list-collector", + "type": "ListCollector", + "for_list": "people", + "question": { + "id": "confirmation-question", + "type": "General", + "title": "Does anyone else live here?", + "answers": [ + { + "id": "anyone-else", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RedirectToListAddBlock" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + }, + "add_block": { + "id": "add-person", + "type": "ListAddQuestion", + "question": { + "id": "add-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "edit_block": { + "id": "edit-person", + "type": "ListEditQuestion", + "question": { + "id": "edit-question", + "type": "General", + "title": "What is the name of the person?", + "answers": [ + { + "id": "first-name", + "label": "First name", + "mandatory": true, + "type": "TextField" + }, + { + "id": "last-name", + "label": "Last name", + "mandatory": true, + "type": "TextField" + } + ] + } + }, + "remove_block": { + "id": "remove-person", + "type": "ListRemoveQuestion", + "question": { + "id": "remove-question", + "type": "General", + "title": "Are you sure you want to remove this person?", + "answers": [ + { + "id": "remove-confirmation", + "mandatory": true, + "type": "Radio", + "options": [ + { + "label": "Yes", + "value": "Yes", + "action": { + "type": "RemoveListItemAndAnswers" + } + }, + { + "label": "No", + "value": "No" + } + ] + } + ] + } + }, + "summary": { + "title": "Household members", + "item_title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "arguments": { + "delimiter": " ", + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ] + }, + "transform": "concatenate_list" + } + ] + } + ] + } + } + } + ] + } + ] + }, + { + "id": "personal-details-section", + "title": "Personal Details", + "summary": { "show_on_completion": true }, + "repeat": { + "for_list": "people", + "title": { + "text": "{person_name}", + "placeholders": [ + { + "placeholder": "person_name", + "transforms": [ + { + "transform": "concatenate_list", + "arguments": { + "list_to_concatenate": [ + { + "source": "answers", + "identifier": "first-name" + }, + { + "source": "answers", + "identifier": "last-name" + } + ], + "delimiter": " " + } + } + ] + } + ] + } + }, + "groups": [ + { + "id": "personal-details-group", + "title": "Personal Details", + "blocks": [ + { + "id": "list-status", + "question_variants": [ + { + "question": { + "answers": [ + { + "id": "list-status-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "list-status-question", + "title": "You are the first person in the list", + "type": "General" + }, + "when": { + "==": [ + { + "source": "list", + "identifier": "people", + "selector": "first" + }, + { + "source": "location", + "identifier": "list_item_id" + } + ] + } + }, + { + "question": { + "answers": [ + { + "id": "list-status-answer", + "mandatory": false, + "options": [ + { + "label": "Yes", + "value": "Yes" + }, + { + "label": "No", + "value": "No" + } + ], + "type": "Radio" + } + ], + "id": "list-status-question", + "title": "You are not the first person in the list", + "type": "General" + }, + "when": { + "!=": [ + { + "source": "list", + "identifier": "people", + "selector": "first" + }, + { + "source": "location", + "identifier": "list_item_id" + } + ] + } + } + ], + "type": "Question" + } + ] + } + ] + } + ] +}