Documentation

Get All Children Question

Article

Get All Children Question

When and Why to Use

Use this when you need a complete roster of children within an age window, including:

  • total count,
  • each child's age (with optional recodes),
  • each child's gender,
  • a readable "name" label (e.g., "16 year old son") for downstream questions.

Great for: youth-targeted studies, quota setup, segmentation, or routing follow-ups to each child profile.

Chat Experience
  • Three-step flow: count → ages → genders.
  • Copy for each step is customizable via question_1_text-question_3_text.
  • Gender terms shown to respondents can be mapped to "son/daughter" (or alternatives) via gender_map.
Traditional Experience
  • Sequential screens and compact multi-field forms.
  • Numeric input for count/ages; single/multi-select for genders.
  • Summary list of created child records before proceeding (optional).
Configuration Options
OptionTypeRequiredDefaultDescription
min_ageintyes-Minimum eligible age.
max_ageintyes-Maximum eligible age.
age_recodesOptional[Dict[int, str]]noNoneMap raw ages to recoded labels (e.g., 13: "Secondary").
gender_mapOptional[Dict[str, str]]no{ "Male": "son", "Female": "daughter" }Maps gender → child term used in the "name" label.
question_1_textOptional[str]no"How many children do you have between the ages of {min_age} and {max_age}?"Custom text for count prompt.
question_2_textOptional[str]no"For each child, please let us know their age"Custom text for ages prompt.
question_3_textOptional[str]no"Now, please let us know their gender"Custom text for genders prompt.
Return Value

List[StringResponse] - One StringResponse per child, with tags attached:

  • age: the recoded age (if age_recodes supplied; otherwise raw age as string),
  • gender: the selected gender,
  • name: a readable label combining age and gender_map term (e.g., "16 year old son").

If the respondent reports no eligible children, returns an empty list.

Example Code
Basic usage
from survey import Survey

s = Survey(**globals())

children = s.get_all_children_age_gender(
    min_age=5,
    max_age=18,
)

for child in children:
    s.text_question(f"What is {child.name}'s favorite subject in school?")

s.complete()
With age recodes and custom gender terms
children = s.get_all_children_age_gender(
    min_age=5,
    max_age=17,
    age_recodes={
        5: "Pre-school",
        6: "Primary",
        7: "Primary",
        8: "Primary",
        9: "Primary",
        10: "Primary",
        11: "Secondary",
        12: "Secondary",
        13: "Secondary",
        14: "Secondary",
        15: "Secondary",
        16: "Secondary",
        17: "Secondary",
    },
    gender_map={"Male": "boy", "Female": "girl"},
)
Custom question copy
children = s.get_all_children_age_gender(
    min_age=10,
    max_age=16,
    question_1_text="Between {min_age} and {max_age}, how many children live in your household?",
    question_2_text="Please enter each child's age.",
    question_3_text="Please select each child's gender."
)
Notes
  • Validation is performed on raw ages; age_recodes affect labels/reporting only.
  • Expand gender options as needed (e.g., "Non-binary," "Prefer not to say"); use gender_map to control the child term used in name.
  • The name field is for respondent-friendly copy; avoid relying on it for programmatic logic - use age and gender tags instead.