diff --git a/api_questions.json b/api_questions.json new file mode 100644 index 0000000..b27446e --- /dev/null +++ b/api_questions.json @@ -0,0 +1 @@ +[{"id": "family_background.number_of_siblings", "type": "number", "title": "Number of Siblings", "description": "", "tooltip": "", "placeholder": "2", "required": true, "is_required": true, "private": false, "is_private": false, "show_guardian_notice": false, "validation": {"max": 20, "min": 0}, "ui_config": {"private": false, "noSearch": false, "placeholder_en": "2", "placeholder_fa": "\u06f2"}, "logic": null, "audience": null, "required_when": null, "visibility": null, "conditional_rule": null, "is_visible": true, "order": 0, "options": []}, {"id": "family_background.parents_survival_status", "type": "radio", "title": "Parents' Survival Status", "description": "", "tooltip": "", "placeholder": "Select one option", "required": true, "is_required": true, "private": false, "is_private": false, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": false, "noSearch": false, "placeholder_en": "Select one option", "placeholder_fa": "\u06cc\u06a9 \u06af\u0632\u06cc\u0646\u0647 \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u062f"}, "logic": null, "audience": null, "required_when": null, "visibility": null, "conditional_rule": null, "is_visible": true, "order": 1, "options": [{"id": "family_background.parents_survival_status.both_parents_are_alive", "value": "both_parents_are_alive", "label": "Both parents are alive", "order": 0}, {"id": "family_background.parents_survival_status.father_has_passed_away", "value": "father_has_passed_away", "label": "Father has passed away", "order": 1}, {"id": "family_background.parents_survival_status.mother_has_passed_away", "value": "mother_has_passed_away", "label": "Mother has passed away", "order": 2}, {"id": "family_background.parents_survival_status.both_parents_have_passed_away", "value": "both_parents_have_passed_away", "label": "Both parents have passed away", "order": 3}]}, {"id": "family_background.parents_marital_status", "type": "radio", "title": "Parents' Marital Status", "description": "", "tooltip": "", "placeholder": "Select one option", "required": true, "is_required": true, "private": true, "is_private": true, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": true, "noSearch": false, "placeholder_en": "Select one option", "placeholder_fa": "\u06cc\u06a9 \u06af\u0632\u06cc\u0646\u0647 \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u062f"}, "logic": {"dependsOn": {"title": "Parents' Survival Status", "values": ["Both parents are alive"]}}, "audience": null, "required_when": {"operator": "any_of", "parent_question_id": "family_background.parents_survival_status", "trigger_option_ids": ["family_background.parents_survival_status.both_parents_are_alive"], "clear_answer_when_hidden": true}, "visibility": {"operator": "any_of", "parent_question_id": "family_background.parents_survival_status", "trigger_option_ids": ["family_background.parents_survival_status.both_parents_are_alive"], "clear_answer_when_hidden": true}, "conditional_rule": {"operator": "any_of", "parent_question_id": "family_background.parents_survival_status", "trigger_option_ids": ["family_background.parents_survival_status.both_parents_are_alive"], "clear_answer_when_hidden": true}, "is_visible": true, "order": 2, "options": [{"id": "family_background.parents_marital_status.living_together", "value": "living_together", "label": "Living together", "order": 0}, {"id": "family_background.parents_marital_status.separated_divorced", "value": "separated_/_divorced", "label": "Separated / Divorced", "order": 1}, {"id": "family_background.parents_marital_status.one_parent_has_remarried", "value": "one_parent_has_remarried", "label": "One parent has remarried", "order": 2}, {"id": "family_background.parents_marital_status.i_have_special_family_circumstances_and_will_provide_the_details_in_the_description", "value": "i_have_special_family_circumstances_and_will_provide_the_details_in_the_description.", "label": "I have special family circumstances and will provide the details in the description.", "order": 3}]}, {"id": "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member", "type": "radio", "title": "Do you currently have an ongoing financial, caregiving, or guardianship responsibility for a family member?", "description": "", "tooltip": "", "placeholder": "Select one option", "required": true, "is_required": true, "private": true, "is_private": true, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": true, "noSearch": false, "placeholder_en": "Select one option", "placeholder_fa": "\u06cc\u06a9 \u06af\u0632\u06cc\u0646\u0647 \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u062f"}, "logic": null, "audience": null, "required_when": null, "visibility": null, "conditional_rule": null, "is_visible": true, "order": 3, "options": [{"id": "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.no_i_do_not_have_any_ongoing_responsibility", "value": "no,_i_do_not_have_any_ongoing_responsibility.", "label": "No, I do not have any ongoing responsibility.", "order": 0}, {"id": "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_father", "value": "i_am_responsible_for_caring_for_my_father.", "label": "I am responsible for caring for my father.", "order": 1}, {"id": "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_mother", "value": "i_am_responsible_for_caring_for_my_mother.", "label": "I am responsible for caring for my mother.", "order": 2}, {"id": "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_both_parents", "value": "i_am_responsible_for_caring_for_both_parents.", "label": "I am responsible for caring for both parents.", "order": 3}, {"id": "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_a_sibling_brother_sister", "value": "i_am_responsible_for_caring_for_a_sibling_(brother/sister).", "label": "I am responsible for caring for a sibling (brother/sister).", "order": 4}, {"id": "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_the_legal_guardian_or_supervisor_of_a_family_member", "value": "i_am_the_legal_guardian_or_supervisor_of_a_family_member.", "label": "I am the legal guardian or supervisor of a family member.", "order": 5}, {"id": "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_regularly_provide_financial_support_for_a_family_member_s_living_expenses", "value": "i_regularly_provide_financial_support_for_a_family_member's_living_expenses.", "label": "I regularly provide financial support for a family member's living expenses.", "order": 6}, {"id": "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_have_other_circumstances_and_will_explain_in_the_description", "value": "i_have_other_circumstances_and_will_explain_in_the_description.", "label": "I have other circumstances and will explain in the description.", "order": 7}]}, {"id": "family_background.do_the_supported_individual_s_live_with_you", "type": "radio", "title": "Do the supported individual(s) live with you?", "description": "", "tooltip": "", "placeholder": "Select one option", "required": true, "is_required": true, "private": true, "is_private": true, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": true, "noSearch": false, "placeholder_en": "Select one option", "placeholder_fa": "\u06cc\u06a9 \u06af\u0632\u06cc\u0646\u0647 \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u062f"}, "logic": {"dependsOn": {"title": "Do you currently have an ongoing financial, caregiving, or guardianship responsibility for a family member?", "values": ["I am responsible for caring for my father.", "I am responsible for caring for my mother.", "I am responsible for caring for both parents.", "I am responsible for caring for a sibling (brother/sister).", "I am the legal guardian or supervisor of a family member.", "I regularly provide financial support for a family member's living expenses.", "I have other circumstances and will explain in the description.", "I am responsible for caring for my parent(s) (father, mother, or both).", "I am responsible for the care, custody, or guardianship of other family members (sibling, etc.)."]}}, "audience": null, "required_when": {"operator": "any_of", "parent_question_id": "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member", "trigger_option_ids": ["family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_parent_s_father_mother_or_both", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_the_care_custody_or_guardianship_of_other_family_members_sibling_etc", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_regularly_provide_financial_support_for_a_family_member_s_living_expenses", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_father", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_mother", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_both_parents", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_a_sibling_brother_sister", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_the_legal_guardian_or_supervisor_of_a_family_member", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_have_other_circumstances_and_will_explain_in_the_description"], "clear_answer_when_hidden": true}, "visibility": {"operator": "any_of", "parent_question_id": "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member", "trigger_option_ids": ["family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_parent_s_father_mother_or_both", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_the_care_custody_or_guardianship_of_other_family_members_sibling_etc", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_regularly_provide_financial_support_for_a_family_member_s_living_expenses", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_father", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_mother", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_both_parents", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_a_sibling_brother_sister", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_the_legal_guardian_or_supervisor_of_a_family_member", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_have_other_circumstances_and_will_explain_in_the_description"], "clear_answer_when_hidden": true}, "conditional_rule": {"operator": "any_of", "parent_question_id": "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member", "trigger_option_ids": ["family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_parent_s_father_mother_or_both", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_the_care_custody_or_guardianship_of_other_family_members_sibling_etc", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_regularly_provide_financial_support_for_a_family_member_s_living_expenses", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_father", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_mother", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_both_parents", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_a_sibling_brother_sister", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_the_legal_guardian_or_supervisor_of_a_family_member", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_have_other_circumstances_and_will_explain_in_the_description"], "clear_answer_when_hidden": true}, "is_visible": true, "order": 4, "options": [{"id": "family_background.do_the_supported_individual_s_live_with_you.yes_they_live_with_me_permanently", "value": "yes,_they_live_with_me_permanently.", "label": "Yes, they live with me permanently.", "order": 0}, {"id": "family_background.do_the_supported_individual_s_live_with_you.yes_they_live_with_me_temporarily_or_periodically", "value": "yes,_they_live_with_me_temporarily_or_periodically.", "label": "Yes, they live with me temporarily or periodically.", "order": 1}, {"id": "family_background.do_the_supported_individual_s_live_with_you.no_but_they_reside_near_my_place_of_living", "value": "no,_but_they_reside_near_my_place_of_living.", "label": "No, but they reside near my place of living.", "order": 2}, {"id": "family_background.do_the_supported_individual_s_live_with_you.no_they_live_in_another_city_or_country", "value": "no,_they_live_in_another_city_or_country.", "label": "No, they live in another city or country.", "order": 3}]}, {"id": "family_background.additional_details_about_family_responsibility", "type": "textarea", "title": "Additional details about family responsibility", "description": "", "tooltip": "familyResponsibilityTooltip", "placeholder": "Enter details here...", "required": true, "is_required": true, "private": true, "is_private": true, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": true, "noSearch": false, "placeholder_en": "Enter details here...", "placeholder_fa": "\u062a\u0648\u0636\u06cc\u062d\u0627\u062a \u062e\u0648\u062f \u0631\u0627 \u0627\u06cc\u0646\u062c\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f..."}, "logic": {"dependsOn": {"title": "Do you currently have an ongoing financial, caregiving, or guardianship responsibility for a family member?", "values": ["I am responsible for caring for my father.", "I am responsible for caring for my mother.", "I am responsible for caring for both parents.", "I am responsible for caring for a sibling (brother/sister).", "I am the legal guardian or supervisor of a family member.", "I regularly provide financial support for a family member's living expenses.", "I have other circumstances and will explain in the description.", "I am responsible for caring for my parent(s) (father, mother, or both).", "I am responsible for the care, custody, or guardianship of other family members (sibling, etc.)."]}}, "audience": null, "required_when": {"operator": "any_of", "parent_question_id": "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member", "trigger_option_ids": ["family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_parent_s_father_mother_or_both", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_the_care_custody_or_guardianship_of_other_family_members_sibling_etc", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_regularly_provide_financial_support_for_a_family_member_s_living_expenses", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_father", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_mother", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_both_parents", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_a_sibling_brother_sister", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_the_legal_guardian_or_supervisor_of_a_family_member", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_have_other_circumstances_and_will_explain_in_the_description"], "clear_answer_when_hidden": true}, "visibility": {"operator": "any_of", "parent_question_id": "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member", "trigger_option_ids": ["family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_parent_s_father_mother_or_both", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_the_care_custody_or_guardianship_of_other_family_members_sibling_etc", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_regularly_provide_financial_support_for_a_family_member_s_living_expenses", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_father", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_mother", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_both_parents", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_a_sibling_brother_sister", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_the_legal_guardian_or_supervisor_of_a_family_member", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_have_other_circumstances_and_will_explain_in_the_description"], "clear_answer_when_hidden": true}, "conditional_rule": {"operator": "any_of", "parent_question_id": "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member", "trigger_option_ids": ["family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_parent_s_father_mother_or_both", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_the_care_custody_or_guardianship_of_other_family_members_sibling_etc", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_regularly_provide_financial_support_for_a_family_member_s_living_expenses", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_father", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_mother", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_both_parents", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_a_sibling_brother_sister", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_the_legal_guardian_or_supervisor_of_a_family_member", "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_have_other_circumstances_and_will_explain_in_the_description"], "clear_answer_when_hidden": true}, "is_visible": true, "order": 5, "options": []}, {"id": "family_background.family_s_religious_and_ideological_atmosphere", "type": "radio", "title": "Family's Religious and Ideological Atmosphere", "description": "Please select the option that best describes the general atmosphere and lifestyle of your family.", "tooltip": "### Family Religious Atmosphere Options\n\n* **Religious and Strictly Observant:** This specifies a family highly dedicated to performing all **obligatory duties**, strictly maintaining **religious boundaries** (such as Mahram rules), and upholding **religious rituals and teachings** across all aspects of life.\n* **Religious (Observant of Obligations):** This indicates a family committed to core **religious duties** (such as prayer and fasting) and **Islamic ethics**, living within the standard frameworks of a religious society.\n* **Traditional (Respectful of Religious Values):** This describes a family that holds devotion to moral values and **respects religion**, but may not strictly execute every specific **religious law** or obligation.\n* **Non-religious / Secular:** This represents a family where **religious rituals and frameworks** do not significantly influence their daily **lifestyle, relationships, or decisions**, despite holding a general respect for religion.", "placeholder": "Select one option", "required": false, "is_required": false, "private": false, "is_private": false, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": false, "noSearch": false, "placeholder_en": "Select one option", "placeholder_fa": "\u06cc\u06a9 \u06af\u0632\u06cc\u0646\u0647 \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u062f"}, "logic": null, "audience": null, "required_when": null, "visibility": null, "conditional_rule": null, "is_visible": true, "order": 6, "options": [{"id": "family_background.family_s_religious_and_ideological_atmosphere.religious_and_strictly_observant", "value": "religious_and_strictly_observant", "label": "Religious and strictly observant", "order": 0}, {"id": "family_background.family_s_religious_and_ideological_atmosphere.religious_observant_of_obligations", "value": "religious_(observant_of_obligations)", "label": "Religious (observant of obligations)", "order": 1}, {"id": "family_background.family_s_religious_and_ideological_atmosphere.traditional_respectful_of_religious_values", "value": "traditional_(respectful_of_religious_values)", "label": "Traditional (respectful of religious values)", "order": 2}, {"id": "family_background.family_s_religious_and_ideological_atmosphere.non_religious_secular", "value": "non-religious_/_secular", "label": "Non-religious / Secular", "order": 3}]}, {"id": "family_background.family_economic_status", "type": "radio", "title": "Family Economic Status", "description": "", "tooltip": "", "placeholder": "Select one option", "required": false, "is_required": false, "private": false, "is_private": false, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": false, "noSearch": false, "placeholder_en": "Select one option", "placeholder_fa": "\u06cc\u06a9 \u06af\u0632\u06cc\u0646\u0647 \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u062f"}, "logic": null, "audience": null, "required_when": null, "visibility": null, "conditional_rule": null, "is_visible": true, "order": 7, "options": [{"id": "family_background.family_economic_status.weak", "value": "weak", "label": "Weak", "order": 0}, {"id": "family_background.family_economic_status.average", "value": "average", "label": "Average", "order": 1}, {"id": "family_background.family_economic_status.good", "value": "good", "label": "Good", "order": 2}, {"id": "family_background.family_economic_status.prosperous", "value": "prosperous", "label": "Prosperous", "order": 3}]}, {"id": "family_background.short_family_description", "type": "textarea", "title": "Short Family Description", "description": "", "tooltip": "Write any important point that was not covered in the options above here.", "placeholder": "Enter details here...", "required": false, "is_required": false, "private": false, "is_private": false, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": false, "noSearch": false, "placeholder_en": "Enter details here...", "placeholder_fa": "\u062a\u0648\u0636\u06cc\u062d\u0627\u062a \u062e\u0648\u062f \u0631\u0627 \u0627\u06cc\u0646\u062c\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f..."}, "logic": {"operator": "any_of", "parent_question_id": "family_background.parents_marital_status", "trigger_option_ids": ["family_background.parents_marital_status.i_have_special_family_circumstances_and_will_provide_the_details_in_the_description"], "clear_answer_when_hidden": true}, "audience": null, "required_when": {"operator": "any_of", "parent_question_id": "family_background.parents_marital_status", "trigger_option_ids": ["family_background.parents_marital_status.i_have_special_family_circumstances_and_will_provide_the_details_in_the_description"], "clear_answer_when_hidden": true}, "visibility": {"operator": "any_of", "parent_question_id": "family_background.parents_marital_status", "trigger_option_ids": ["family_background.parents_marital_status.i_have_special_family_circumstances_and_will_provide_the_details_in_the_description"], "clear_answer_when_hidden": true}, "conditional_rule": {"operator": "any_of", "parent_question_id": "family_background.parents_marital_status", "trigger_option_ids": ["family_background.parents_marital_status.i_have_special_family_circumstances_and_will_provide_the_details_in_the_description"], "clear_answer_when_hidden": true}, "is_visible": false, "order": 8, "options": []}] \ No newline at end of file diff --git a/api_questions_marital.json b/api_questions_marital.json new file mode 100644 index 0000000..5997b3b --- /dev/null +++ b/api_questions_marital.json @@ -0,0 +1 @@ +[{"id": "marital_history.current_marital_status", "type": "radio", "title": "Current Marital Status", "description": "", "tooltip": "currentMaritalStatusTooltip", "placeholder": "Select one option", "required": true, "is_required": true, "private": true, "is_private": true, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": true, "noSearch": false, "placeholder_en": "Select one option", "placeholder_fa": "\u06cc\u06a9 \u06af\u0632\u06cc\u0646\u0647 \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u062f"}, "logic": null, "audience": null, "required_when": null, "visibility": null, "conditional_rule": null, "is_visible": true, "order": 0, "options": [{"id": "marital_history.current_marital_status.single_never_married", "value": "single;_never_married", "label": "Single; never married", "order": 0}, {"id": "marital_history.current_marital_status.failed_engagement_annulled_marriage_without_living_together", "value": "failed_engagement_/_annulled_marriage;_without_living_together", "label": "Failed engagement / Annulled marriage; without living together", "order": 1}, {"id": "marital_history.current_marital_status.divorced_after_living_together", "value": "divorced;_after_living_together", "label": "Divorced; after living together", "order": 2}, {"id": "marital_history.current_marital_status.widowed", "value": "widowed", "label": "Widowed", "order": 3}]}, {"id": "marital_history.previous_marriage_duration", "type": "text", "title": "Previous Marriage Duration", "description": "", "tooltip": "", "placeholder": "3 years", "required": true, "is_required": true, "private": true, "is_private": true, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": true, "noSearch": false, "placeholder_en": "3 years", "placeholder_fa": "\u06f3 \u0633\u0627\u0644", "showYearsSuffix": true}, "logic": {"dependsOn": {"title": "Current Marital Status", "values": ["Failed engagement / Annulled marriage; without living together", "Divorced; after living together", "Widowed"]}}, "audience": null, "required_when": {"operator": "any_of", "parent_question_id": "marital_history.current_marital_status", "trigger_option_ids": ["marital_history.current_marital_status.failed_engagement_annulled_marriage_without_living_together", "marital_history.current_marital_status.failed_marriage_contract_annulled_engagement_without_starting_joint_life", "marital_history.current_marital_status.divorced_after_living_together", "marital_history.current_marital_status.widowed"], "clear_answer_when_hidden": true}, "visibility": {"operator": "any_of", "parent_question_id": "marital_history.current_marital_status", "trigger_option_ids": ["marital_history.current_marital_status.failed_engagement_annulled_marriage_without_living_together", "marital_history.current_marital_status.failed_marriage_contract_annulled_engagement_without_starting_joint_life", "marital_history.current_marital_status.divorced_after_living_together", "marital_history.current_marital_status.widowed"], "clear_answer_when_hidden": true}, "conditional_rule": {"operator": "any_of", "parent_question_id": "marital_history.current_marital_status", "trigger_option_ids": ["marital_history.current_marital_status.failed_engagement_annulled_marriage_without_living_together", "marital_history.current_marital_status.failed_marriage_contract_annulled_engagement_without_starting_joint_life", "marital_history.current_marital_status.divorced_after_living_together", "marital_history.current_marital_status.widowed"], "clear_answer_when_hidden": true}, "is_visible": true, "order": 1, "options": []}, {"id": "marital_history.reason_for_separation", "type": "text", "title": "Reason for Separation", "description": "", "tooltip": "", "placeholder": "Enter details here...", "required": false, "is_required": false, "private": true, "is_private": true, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": true, "noSearch": false, "placeholder_en": "Enter details here...", "placeholder_fa": "\u062a\u0648\u0636\u06cc\u062d\u0627\u062a \u0631\u0627 \u0627\u06cc\u0646\u062c\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f..."}, "logic": {"dependsOn": {"title": "Current Marital Status", "values": ["Failed engagement / Annulled marriage; without living together", "Divorced; after living together"]}}, "audience": null, "required_when": null, "visibility": {"operator": "any_of", "parent_question_id": "marital_history.current_marital_status", "trigger_option_ids": ["marital_history.current_marital_status.failed_engagement_annulled_marriage_without_living_together", "marital_history.current_marital_status.failed_marriage_contract_annulled_engagement_without_starting_joint_life", "marital_history.current_marital_status.divorced_after_living_together"], "clear_answer_when_hidden": true}, "conditional_rule": {"operator": "any_of", "parent_question_id": "marital_history.current_marital_status", "trigger_option_ids": ["marital_history.current_marital_status.failed_engagement_annulled_marriage_without_living_together", "marital_history.current_marital_status.failed_marriage_contract_annulled_engagement_without_starting_joint_life", "marital_history.current_marital_status.divorced_after_living_together"], "clear_answer_when_hidden": true}, "is_visible": true, "order": 2, "options": []}, {"id": "marital_history.children_and_guardianship_status", "type": "radio", "title": "Children and Guardianship Status", "description": "", "tooltip": "", "placeholder": "Select one option", "required": true, "is_required": true, "private": true, "is_private": true, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": true, "noSearch": false, "placeholder_en": "Select one option", "placeholder_fa": "\u06cc\u06a9 \u06af\u0632\u06cc\u0646\u0647 \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u062f"}, "logic": {"dependsOn": {"title": "Current Marital Status", "values": ["Failed engagement / annulled marriage without starting joint life", "Divorced; after living together", "Widowed"]}}, "audience": null, "required_when": {"operator": "any_of", "parent_question_id": "marital_history.current_marital_status", "trigger_option_ids": ["marital_history.current_marital_status.failed_engagement_annulled_marriage_without_living_together", "marital_history.current_marital_status.failed_marriage_contract_annulled_engagement_without_starting_joint_life", "marital_history.current_marital_status.divorced_after_living_together", "marital_history.current_marital_status.widowed"], "clear_answer_when_hidden": true}, "visibility": {"operator": "any_of", "parent_question_id": "marital_history.current_marital_status", "trigger_option_ids": ["marital_history.current_marital_status.failed_engagement_annulled_marriage_without_living_together", "marital_history.current_marital_status.failed_marriage_contract_annulled_engagement_without_starting_joint_life", "marital_history.current_marital_status.divorced_after_living_together", "marital_history.current_marital_status.widowed"], "clear_answer_when_hidden": true}, "conditional_rule": {"operator": "any_of", "parent_question_id": "marital_history.current_marital_status", "trigger_option_ids": ["marital_history.current_marital_status.failed_engagement_annulled_marriage_without_living_together", "marital_history.current_marital_status.failed_marriage_contract_annulled_engagement_without_starting_joint_life", "marital_history.current_marital_status.divorced_after_living_together", "marital_history.current_marital_status.widowed"], "clear_answer_when_hidden": true}, "is_visible": true, "order": 3, "options": [{"id": "marital_history.children_and_guardianship_status.no_children", "value": "no_children", "label": "No children", "order": 0}, {"id": "marital_history.children_and_guardianship_status.have_children_living_with_me", "value": "have_children_living_with_me", "label": "Have children living with me", "order": 1}, {"id": "marital_history.children_and_guardianship_status.have_children_not_living_with_me", "value": "have_children_not_living_with_me", "label": "Have children not living with me", "order": 2}, {"id": "marital_history.children_and_guardianship_status.someone_else_is_under_my_guardianship", "value": "someone_else_is_under_my_guardianship", "label": "Someone else is under my guardianship", "order": 3}]}, {"id": "marital_history.number_of_children", "type": "number", "title": "Number of Children", "description": "", "tooltip": "", "placeholder": "2", "required": true, "is_required": false, "private": true, "is_private": true, "show_guardian_notice": false, "validation": {"max": 10, "min": 0}, "ui_config": {"private": true, "noSearch": false, "placeholder_en": "2", "placeholder_fa": "\u06f2"}, "logic": {"dependsOn": {"title": "Children and Guardianship Status", "values": ["Have children living with me", "Have children not living with me"]}}, "audience": null, "required_when": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "visibility": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "conditional_rule": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "is_visible": false, "order": 4, "options": []}, {"id": "marital_history.what_is_the_custody_status_of_your_child_ren", "type": "radio", "title": "What is the custody status of your child(ren)?", "description": "", "tooltip": "", "placeholder": "Select one option", "required": true, "is_required": false, "private": true, "is_private": true, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": true, "noSearch": false, "placeholder_en": "Select one option", "placeholder_fa": "\u06cc\u06a9 \u06af\u0632\u06cc\u0646\u0647 \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u062f"}, "logic": {"dependsOn": {"title": "Children and Guardianship Status", "values": ["Have children living with me", "Have children not living with me"]}}, "audience": null, "required_when": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "visibility": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "conditional_rule": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "is_visible": false, "order": 5, "options": [{"id": "marital_history.what_is_the_custody_status_of_your_child_ren.i_have_full_custody_of_the_child_ren", "value": "i_have_full_custody_of_the_child(ren).", "label": "I have full custody of the child(ren).", "order": 0}, {"id": "marital_history.what_is_the_custody_status_of_your_child_ren.joint_custody_or_periodic_visitation_relocation_between_parents", "value": "joint_custody_or_periodic_visitation/relocation_between_parents.", "label": "Joint custody or periodic visitation/relocation between parents.", "order": 1}, {"id": "marital_history.what_is_the_custody_status_of_your_child_ren.custody_is_with_the_other_parent_or_another_person", "value": "custody_is_with_the_other_parent_or_another_person.", "label": "Custody is with the other parent or another person.", "order": 2}, {"id": "marital_history.what_is_the_custody_status_of_your_child_ren.children_have_reached_legal_age_custody_is_not_applicable", "value": "children_have_reached_legal_age_(custody_is_not_applicable).", "label": "Children have reached legal age (custody is not applicable).", "order": 3}, {"id": "marital_history.what_is_the_custody_status_of_your_child_ren.other_circumstances_dispute_pending_or_other", "value": "other_circumstances_(dispute,_pending,_or_other).", "label": "Other circumstances (dispute, pending, or other).", "order": 4}]}, {"id": "marital_history.how_much_time_do_the_child_ren_usually_live_with_you", "type": "radio", "title": "How much time do the child(ren) usually live with you?", "description": "", "tooltip": "", "placeholder": "Select one option", "required": true, "is_required": false, "private": true, "is_private": true, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": true, "noSearch": false, "placeholder_en": "Select one option", "placeholder_fa": "\u06cc\u06a9 \u06af\u0632\u06cc\u0646\u0647 \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u062f"}, "logic": {"dependsOn": {"title": "Children and Guardianship Status", "values": ["Have children living with me", "Have children not living with me"]}}, "audience": null, "required_when": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "visibility": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "conditional_rule": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "is_visible": false, "order": 6, "options": [{"id": "marital_history.how_much_time_do_the_child_ren_usually_live_with_you.permanently_or_most_days_of_the_week_with_me", "value": "permanently_or_most_days_of_the_week_with_me.", "label": "Permanently or most days of the week with me.", "order": 0}, {"id": "marital_history.how_much_time_do_the_child_ren_usually_live_with_you.approximately_half_the_time_joint_custody_schedule", "value": "approximately_half_the_time_(joint_custody/schedule).", "label": "Approximately half the time (joint custody/schedule).", "order": 1}, {"id": "marital_history.how_much_time_do_the_child_ren_usually_live_with_you.weekends_holidays_or_specific_days_only", "value": "weekends,_holidays,_or_specific_days_only.", "label": "Weekends, holidays, or specific days only.", "order": 2}, {"id": "marital_history.how_much_time_do_the_child_ren_usually_live_with_you.they_do_not_live_with_me_or_there_is_no_fixed_schedule", "value": "they_do_not_live_with_me,_or_there_is_no_fixed_schedule.", "label": "They do not live with me, or there is no fixed schedule.", "order": 3}]}, {"id": "marital_history.does_the_custody_visitation_or_relocation_schedule_impact_your_residence_or_immigration", "type": "radio", "title": "Does the custody, visitation, or relocation schedule impact your residence or immigration?", "description": "", "tooltip": "", "placeholder": "Select one option", "required": true, "is_required": false, "private": true, "is_private": true, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": true, "noSearch": false, "placeholder_en": "Select one option", "placeholder_fa": "\u06cc\u06a9 \u06af\u0632\u06cc\u0646\u0647 \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u062f"}, "logic": {"dependsOn": {"title": "Children and Guardianship Status", "values": ["Have children living with me", "Have children not living with me"]}}, "audience": null, "required_when": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "visibility": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "conditional_rule": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "is_visible": false, "order": 7, "options": [{"id": "marital_history.does_the_custody_visitation_or_relocation_schedule_impact_your_residence_or_immigration.no_it_has_no_significant_impact_on_residence_or_relocation", "value": "no,_it_has_no_significant_impact_on_residence_or_relocation.", "label": "No, it has no significant impact on residence or relocation.", "order": 0}, {"id": "marital_history.does_the_custody_visitation_or_relocation_schedule_impact_your_residence_or_immigration.yes_relocation_or_immigration_requires_coordination_agreement_or_a_legal_permit", "value": "yes,_relocation_or_immigration_requires_coordination,_agreement,_or_a_legal_permit.", "label": "Yes, relocation or immigration requires coordination, agreement, or a legal permit.", "order": 1}, {"id": "marital_history.does_the_custody_visitation_or_relocation_schedule_impact_your_residence_or_immigration.yes_i_am_restricted_and_must_reside_in_the_same_city_or_region", "value": "yes,_i_am_restricted_and_must_reside_in_the_same_city_or_region.", "label": "Yes, I am restricted and must reside in the same city or region.", "order": 2}, {"id": "marital_history.does_the_custody_visitation_or_relocation_schedule_impact_your_residence_or_immigration.unclear_pending_dispute_agreement_or_depends_on_conditions", "value": "unclear_(pending_dispute/agreement_or_depends_on_conditions).", "label": "Unclear (pending dispute/agreement or depends on conditions).", "order": 3}]}, {"id": "marital_history.what_is_the_payment_or_receipt_status_of_child_support", "type": "radio", "title": "What is the payment or receipt status of child support?", "description": "", "tooltip": "", "placeholder": "Select one option", "required": true, "is_required": false, "private": true, "is_private": true, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": true, "noSearch": false, "placeholder_en": "Select one option", "placeholder_fa": "\u06cc\u06a9 \u06af\u0632\u06cc\u0646\u0647 \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u062f"}, "logic": {"dependsOn": {"title": "Children and Guardianship Status", "values": ["Have children living with me", "Have children not living with me"]}}, "audience": null, "required_when": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "visibility": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "conditional_rule": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "is_visible": false, "order": 8, "options": [{"id": "marital_history.what_is_the_payment_or_receipt_status_of_child_support.ongoing_financial_commitment_paying_child_support_or_sharing_expenses", "value": "ongoing_financial_commitment_(paying_child_support_or_sharing_expenses).", "label": "Ongoing financial commitment (paying child support or sharing expenses).", "order": 0}, {"id": "marital_history.what_is_the_payment_or_receipt_status_of_child_support.receiving_child_support_regularly", "value": "receiving_child_support_regularly.", "label": "Receiving child support regularly.", "order": 1}, {"id": "marital_history.what_is_the_payment_or_receipt_status_of_child_support.payments_are_case_by_case_agreed_or_irregular", "value": "payments_are_case-by-case,_agreed,_or_irregular.", "label": "Payments are case-by-case, agreed, or irregular.", "order": 2}, {"id": "marital_history.what_is_the_payment_or_receipt_status_of_child_support.no_formal_child_support_commitment_or_child_is_independent_pending", "value": "no_formal_child_support_commitment_(or_child_is_independent_/_pending).", "label": "No formal child support commitment (or child is independent / pending).", "order": 3}]}, {"id": "marital_history.acceptance_of_necessary_communication_between_future_spouse_and_the_other_parent", "type": "radio", "title": "Acceptance of necessary communication between future spouse and the other parent", "description": "", "tooltip": "", "placeholder": "Select one option", "required": true, "is_required": false, "private": true, "is_private": true, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": true, "noSearch": false, "placeholder_en": "Select one option", "placeholder_fa": "\u06cc\u06a9 \u06af\u0632\u06cc\u0646\u0647 \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u062f"}, "logic": {"dependsOn": {"title": "Children and Guardianship Status", "values": ["Have children living with me", "Have children not living with me"]}}, "audience": null, "required_when": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "visibility": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "conditional_rule": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me"], "clear_answer_when_hidden": true}, "is_visible": false, "order": 9, "options": [{"id": "marital_history.acceptance_of_necessary_communication_between_future_spouse_and_the_other_parent.i_accept_necessary_respectful_and_limited_communication_regarding_child_matters", "value": "i_accept_necessary,_respectful,_and_limited_communication_regarding_child_matters.", "label": "I accept necessary, respectful, and limited communication regarding child matters.", "order": 0}, {"id": "marital_history.acceptance_of_necessary_communication_between_future_spouse_and_the_other_parent.i_only_accept_formal_and_highly_limited_communication_regarding_essential_child_matters", "value": "i_only_accept_formal_and_highly_limited_communication_regarding_essential_child_matters.", "label": "I only accept formal and highly limited communication regarding essential child matters.", "order": 1}, {"id": "marital_history.acceptance_of_necessary_communication_between_future_spouse_and_the_other_parent.i_prefer_communication_to_go_through_an_intermediary_a_family_member_or_a_lawyer_as_much_as_possible", "value": "i_prefer_communication_to_go_through_an_intermediary,_a_family_member,_or_a_lawyer_as_much_as_possible.", "label": "I prefer communication to go through an intermediary, a family member, or a lawyer as much as possible.", "order": 2}, {"id": "marital_history.acceptance_of_necessary_communication_between_future_spouse_and_the_other_parent.any_ongoing_communication_beyond_essential_child_matters_with_the_other_parent_is_a_red_line_for_me", "value": "any_ongoing_communication_beyond_essential_child_matters_with_the_other_parent_is_a_red_line_for_me.", "label": "Any ongoing communication beyond essential child matters with the other parent is a red line for me.", "order": 3}, {"id": "marital_history.acceptance_of_necessary_communication_between_future_spouse_and_the_other_parent.acceptance_depends_on_the_type_and_extent_of_communication_custody_conditions_and_mutual_trust", "value": "acceptance_depends_on_the_type_and_extent_of_communication,_custody_conditions,_and_mutual_trust.", "label": "Acceptance depends on the type and extent of communication, custody conditions, and mutual trust.", "order": 4}]}, {"id": "marital_history.short_children_guardianship_explanation", "type": "textarea", "title": "Short Children/Guardianship Explanation", "description": "", "tooltip": "", "placeholder": "Enter details here...", "required": true, "is_required": false, "private": true, "is_private": true, "show_guardian_notice": false, "validation": {}, "ui_config": {"private": true, "noSearch": false, "placeholder_en": "Enter details here...", "placeholder_fa": "\u062a\u0648\u0636\u06cc\u062d\u0627\u062a \u0631\u0627 \u0627\u06cc\u0646\u062c\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f..."}, "logic": {"dependsOn": {"title": "Children and Guardianship Status", "values": ["Have children living with me", "Have children not living with me", "Someone else is under my guardianship"]}}, "audience": null, "required_when": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me", "marital_history.children_and_guardianship_status.someone_else_is_under_my_guardianship"], "clear_answer_when_hidden": true}, "visibility": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me", "marital_history.children_and_guardianship_status.someone_else_is_under_my_guardianship"], "clear_answer_when_hidden": true}, "conditional_rule": {"operator": "any_of", "parent_question_id": "marital_history.children_and_guardianship_status", "trigger_option_ids": ["marital_history.children_and_guardianship_status.have_children_living_with_me", "marital_history.children_and_guardianship_status.have_children_not_living_with_me", "marital_history.children_and_guardianship_status.someone_else_is_under_my_guardianship"], "clear_answer_when_hidden": true}, "is_visible": false, "order": 10, "options": []}] \ No newline at end of file diff --git a/conditional-rules.js b/conditional-rules.js new file mode 100644 index 0000000..9c0d5d1 --- /dev/null +++ b/conditional-rules.js @@ -0,0 +1,237 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.canonicalRule = canonicalRule; +exports.isAnswerPresent = isAnswerPresent; +exports.matchesAudience = matchesAudience; +exports.ruleMatches = ruleMatches; +exports.isQuestionVisible = isQuestionVisible; +exports.isQuestionRequired = isQuestionRequired; +function canonicalRule(rule) { + if (!rule || typeof rule !== "object") { + return null; + } + // If wrapped in dependsOn (legacy) + if (rule.dependsOn && !rule.parent_question_id) { + return { + dependsOn: rule.dependsOn, + }; + } + var operator = ["any_of", "all_of", "equals", "exists"].includes(rule.operator) + ? rule.operator + : "any_of"; + var optionIds = []; + if (Array.isArray(rule.trigger_option_ids)) { + optionIds = rule.trigger_option_ids.map(String); + } + else if (rule.trigger_option_ids !== undefined && rule.trigger_option_ids !== null) { + optionIds = [String(rule.trigger_option_ids)]; + } + var result = { + parent_question_id: rule.parent_question_id || rule.parentQuestionId, + trigger_option_ids: optionIds, + operator: operator, + clear_answer_when_hidden: Boolean(rule.clear_answer_when_hidden), + }; + if (rule.audience && typeof rule.audience === "object") { + result.audience = rule.audience; + } + if (Array.isArray(rule.conditions)) { + result.conditions = rule.conditions + .map(canonicalRule) + .filter(function (c) { return c !== null; }); + result.conditions_operator = + rule.conditions_operator === "any_of" ? "any_of" : "all_of"; + result.root_operator = + rule.root_operator === "any_of" ? "any_of" : "all_of"; + } + return result; +} +function isAnswerPresent(answer) { + if (answer === undefined || answer === null) { + return false; + } + var val = typeof answer === "object" && "value" in answer ? answer.value : answer; + if (val === undefined || val === null) { + return false; + } + if (typeof val === "string") { + return val.trim().length > 0; + } + if (Array.isArray(val)) { + return val.length > 0; + } + if (typeof val === "object") { + return Object.keys(val).length > 0; + } + return true; +} +function getSelectedOptionTokens(answer) { + var tokens = new Set(); + if (!answer) + return tokens; + var rawOptionId = typeof answer === "object" && "option_id" in answer + ? answer.option_id + : undefined; + var rawValue = typeof answer === "object" && "value" in answer ? answer.value : answer; + var addToken = function (item) { + if (item === undefined || item === null) + return; + var str = String(item).trim(); + if (!str) + return; + tokens.add(str.toLowerCase()); + // If it has a dot prefix like "sec.q.opt", also add the suffix "opt" + var lastDot = str.lastIndexOf("."); + if (lastDot !== -1 && lastDot < str.length - 1) { + tokens.add(str.slice(lastDot + 1).toLowerCase()); + } + }; + if (Array.isArray(rawOptionId)) { + rawOptionId.forEach(addToken); + } + else if (rawOptionId !== undefined) { + addToken(rawOptionId); + } + if (Array.isArray(rawValue)) { + rawValue.forEach(addToken); + } + else if (rawValue !== undefined) { + addToken(rawValue); + } + return tokens; +} +function matchesAudience(audience, context) { + if (!audience || typeof audience !== "object") { + return true; + } + if (audience.genders && audience.genders.length > 0) { + if ((context === null || context === void 0 ? void 0 : context.gender) && !audience.genders.includes(context.gender)) { + return false; + } + } + if (audience.minAge !== undefined && (context === null || context === void 0 ? void 0 : context.age) !== undefined && context.age !== null) { + if (context.age < audience.minAge) { + return false; + } + } + if (audience.maxAge !== undefined && (context === null || context === void 0 ? void 0 : context.age) !== undefined && context.age !== null) { + if (context.age > audience.maxAge) { + return false; + } + } + return true; +} +function ruleMatches(rawRule, answers, context) { + var rule = canonicalRule(rawRule); + if (!rule) { + return true; + } + if (rule.audience && !matchesAudience(rule.audience, context)) { + return false; + } + // Handle legacy dependsOn + if (rule.dependsOn && rule.dependsOn.key) { + var parentId_1 = rule.dependsOn.key; + var answer = answers[parentId_1]; + if (!isAnswerPresent(answer)) { + return false; + } + var expectedValues = (rule.dependsOn.values || []).map(function (v) { + return String(v).toLowerCase().trim(); + }); + var actualTokens_1 = getSelectedOptionTokens(answer); + var hasMatch = expectedValues.some(function (v) { return actualTokens_1.has(v); }); + return hasMatch; + } + var mainMatches = true; + var parentId = rule.parent_question_id; + if (parentId) { + var answer = answers[parentId]; + var operator = rule.operator || "any_of"; + if (operator === "exists") { + mainMatches = isAnswerPresent(answer); + } + else if (!isAnswerPresent(answer)) { + mainMatches = false; + } + else { + var actualTokens_2 = getSelectedOptionTokens(answer); + var expectedIds = (rule.trigger_option_ids || []).map(function (id) { + return String(id).toLowerCase().trim(); + }); + var isTokenMatched = function (expectedId) { + if (actualTokens_2.has(expectedId)) + return true; + var lastDot = expectedId.lastIndexOf("."); + if (lastDot !== -1 && lastDot < expectedId.length - 1) { + var suffix = expectedId.slice(lastDot + 1); + if (actualTokens_2.has(suffix)) + return true; + } + return false; + }; + if (operator === "all_of") { + mainMatches = expectedIds.length > 0 && expectedIds.every(isTokenMatched); + } + else if (operator === "equals") { + mainMatches = + expectedIds.length > 0 && + expectedIds.every(isTokenMatched) && + actualTokens_2.size <= expectedIds.length * 2; + } + else { + // default: "any_of" + mainMatches = expectedIds.some(isTokenMatched); + } + } + } + if (rule.conditions && rule.conditions.length > 0) { + var subMatches = rule.conditions.map(function (cond) { + return ruleMatches(cond, answers, context); + }); + var condOperator = rule.conditions_operator || "all_of"; + var conditionsResult = condOperator === "any_of" + ? subMatches.some(Boolean) + : subMatches.every(Boolean); + if (!parentId) { + return conditionsResult; + } + var rootOp = rule.root_operator || "all_of"; + return rootOp === "any_of" + ? mainMatches || conditionsResult + : mainMatches && conditionsResult; + } + return mainMatches; +} +function isQuestionVisible(question, answers, context) { + // 1. Audience check + if (question.audience && !matchesAudience(question.audience, context)) { + return false; + } + // 2. Canonical visibility / conditional rule + var rule = question.visibility || + question.conditionalRule || + question.logic; + if (rule) { + return ruleMatches(rule, answers, context); + } + if (question.isVisible !== undefined) { + return question.isVisible; + } + return true; +} +function isQuestionRequired(question, answers, context) { + if (!isQuestionVisible(question, answers, context)) { + return false; + } + if (question.required || question.baseRequired) { + return true; + } + if (question.requiredWhen) { + if (question.requiredWhen.genders || question.requiredWhen.minAge || question.requiredWhen.maxAge) { + return matchesAudience(question.requiredWhen, context); + } + return ruleMatches(question.requiredWhen, answers, context); + } + return false; +} diff --git a/public/assets/images/sections/09_identity_verification_documents.png b/public/assets/images/sections/09_identity_verification_documents.png index b3b7829..315061f 100644 Binary files a/public/assets/images/sections/09_identity_verification_documents.png and b/public/assets/images/sections/09_identity_verification_documents.png differ diff --git a/test-all.js b/test-all.js new file mode 100644 index 0000000..09c0132 --- /dev/null +++ b/test-all.js @@ -0,0 +1,47 @@ +const fs = require('fs'); +const rules = require('./conditional-rules.js'); + +const answers = { + "family_background.number_of_siblings": { + value: 2, + option_id: null + }, + "family_background.parents_survival_status": { + value: "both_parents_are_alive", + option_id: "family_background.parents_survival_status.both_parents_are_alive" + }, + "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member": { + value: "i_am_responsible_for_caring_for_my_parent(s)_(father,_mother,_or_both).", + option_id: "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_parent_s_father_mother_or_both" + }, + "family_background.family_s_religious_and_ideological_atmosphere": { + value: "religious_(observant_of_obligations)", + option_id: "family_background.family_s_religious_and_ideological_atmosphere.religious_observant_of_obligations" + }, + "family_background.family_economic_status": { + value: "prosperous", + option_id: "family_background.family_economic_status.prosperous" + } +}; + +const questions = JSON.parse(fs.readFileSync('api_questions.json', 'utf8')); +const context = { age: 25, gender: 'male' }; + +for (const q of questions) { + const mapped = { + id: q.id, + type: q.type, + title: q.title, + required: q.is_required !== undefined ? q.is_required : q.required, + baseRequired: q.required, + isVisible: q.is_visible, + conditionalRule: q.conditional_rule || q.visibility || q.logic || undefined, + visibility: q.visibility || q.conditional_rule || undefined, + logic: q.logic || undefined, + requiredWhen: q.required_when || undefined + }; + + const isVis = rules.isQuestionVisible(mapped, answers, context); + const isReq = rules.isQuestionRequired(mapped, answers, context); + console.log(`Q: ${q.id} | Visible: ${isVis} | Required: ${isReq}`); +} diff --git a/test-cond.js b/test-cond.js new file mode 100644 index 0000000..e6b2b2c --- /dev/null +++ b/test-cond.js @@ -0,0 +1,29 @@ +const fs = require('fs'); +const ts = require('typescript'); + +// Compile conditional-rules.ts on the fly +const source = fs.readFileSync('src/lib/conditional-rules.ts', 'utf8'); +const result = ts.transpileModule(source, { compilerOptions: { module: ts.ModuleKind.CommonJS }}); +fs.writeFileSync('conditional-rules.js', result.outputText); + +const rules = require('./conditional-rules.js'); + +const answers = { + "family_background.parents_survival_status": { + value: "both_parents_are_alive", + option_id: "family_background.parents_survival_status.both_parents_are_alive" + } +}; + +const visibility = { + operator: "any_of", + parent_question_id: "family_background.parents_survival_status", + trigger_option_ids: ["family_background.parents_survival_status.both_parents_are_alive"], + clear_answer_when_hidden: true +}; + +const context = { age: 25, gender: 'male' }; + +const isVisible = rules.ruleMatches(visibility, answers, context); +console.log("Is parents_marital_status visible?", isVisible); + diff --git a/test-cond2.js b/test-cond2.js new file mode 100644 index 0000000..3377b79 --- /dev/null +++ b/test-cond2.js @@ -0,0 +1,32 @@ +const fs = require('fs'); +const rules = require('./conditional-rules.js'); + +const answers = { + "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member": { + value: "i_am_responsible_for_caring_for_my_parent(s)_(father,_mother,_or_both).", + option_id: "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_parent_s_father_mother_or_both" + } +}; + +const visibility = { + "operator": "any_of", + "parent_question_id": "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member", + "trigger_option_ids": [ + "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_parent_s_father_mother_or_both", + "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_the_care_custody_or_guardianship_of_other_family_members_sibling_etc", + "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_regularly_provide_financial_support_for_a_family_member_s_living_expenses", + "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_father", + "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_mother", + "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_both_parents", + "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_a_sibling_brother_sister", + "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_the_legal_guardian_or_supervisor_of_a_family_member", + "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_have_other_circumstances_and_will_explain_in_the_description" + ], + "clear_answer_when_hidden": true +}; + +const context = { age: 25, gender: 'male' }; + +const isVisible = rules.ruleMatches(visibility, answers, context); +console.log("Is additional_details visible?", isVisible); + diff --git a/test-cond3.js b/test-cond3.js new file mode 100644 index 0000000..514d09d --- /dev/null +++ b/test-cond3.js @@ -0,0 +1,36 @@ +const fs = require('fs'); +const rules = require('./conditional-rules.js'); + +const answers = { + "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member": { + value: "i_am_responsible_for_caring_for_my_parent(s)_(father,_mother,_or_both).", + option_id: "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_parent_s_father_mother_or_both" + } +}; + +const visibility = { + "operator": "any_of", + "parent_question_id": "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member", + "trigger_option_ids": [ + "family_background.do_you_currently_have_an_ongoing_financial_caregiving_or_guardianship_responsibility_for_a_family_member.i_am_responsible_for_caring_for_my_parent_s_father_mother_or_both" + ], + "clear_answer_when_hidden": true +}; + +const context = { age: 25, gender: 'male' }; + +const question = { + id: "family_background.additional_details_about_family_responsibility", + required: false, + baseRequired: false, // in backend DYNAMIC_REQUIRED sets is_required=True, but what does the schema send? + isVisible: true, + conditionalRule: visibility, + visibility: visibility, +}; + +// Wait, the API sends `required: true` and `is_required: true` when it's dynamically required! +// See check_form_section.py output: family_background.additional_details_about_family_responsibility - is_visible=True is_required=True +question.required = true; +question.baseRequired = true; // Wait, schema adapter does baseRequired: bq.required, and required: bq.is_required !== undefined ? bq.is_required : bq.required + +console.log("Is additional_details required?", rules.isQuestionRequired(question, answers, context)); diff --git a/test-empty.js b/test-empty.js new file mode 100644 index 0000000..aec44d4 --- /dev/null +++ b/test-empty.js @@ -0,0 +1,26 @@ +const fs = require('fs'); +const rules = require('./conditional-rules.js'); + +const answers = {}; + +const questions = JSON.parse(fs.readFileSync('api_questions.json', 'utf8')); +const context = { age: 25, gender: 'male' }; + +for (const q of questions) { + const mapped = { + id: q.id, + type: q.type, + title: q.title, + required: q.is_required !== undefined ? q.is_required : q.required, + baseRequired: q.required, + isVisible: q.is_visible, + conditionalRule: q.conditional_rule || q.visibility || q.logic || undefined, + visibility: q.visibility || q.conditional_rule || undefined, + logic: q.logic || undefined, + requiredWhen: q.required_when || undefined + }; + + const isVis = rules.isQuestionVisible(mapped, answers, context); + const isReq = rules.isQuestionRequired(mapped, answers, context); + console.log(`Q: ${q.id} | Visible: ${isVis} | Required: ${isReq}`); +}