Skip to main content
When creating a human survey or preview (e.g. survey.humanize() or survey.preview()), you can pass a humanize schema to control styling and optionality per question. The schema is validated against your survey before use.

Fields

questions
dict
Map of question name (string) → question config. Each value is a dict with the following properties.
survey
dict
Optional survey-level options (e.g. custom CSS).

Example

from edsl import Survey, QuestionFreeText, QuestionMultipleChoice

survey = Survey([
    QuestionFreeText(question_name="feedback", question_text="Any feedback?"),
    QuestionMultipleChoice(
        question_name="rating",
        question_text="Rate your experience.",
        question_options=["Good", "OK", "Bad"],
    ),
])

humanize_schema = {
    "questions": {
        "feedback": {"optional": True},
        "rating": {"optional": False},
    },
    "survey": {"custom_css": None},
}

# Validation runs before creating the human survey
survey.humanize(humanize_schema=humanize_schema)

Validation

If the schema is invalid, Coop raises HumanizeSchemaValidationError. Common causes:
  • A key in questions is not a question name in the survey, or is an instruction.
  • A question’s type is not supported for humanize schema (e.g. demand, dropdown).
  • A question’s entry has the wrong shape for its type (e.g. wrong field types or extra fields that aren’t allowed).
  • Top-level structure is invalid (e.g. questions not a dict, or an entry not a dict).
You can also pass the schema to survey.preview(humanize_schema=...) to get a preview URL. Ensure your humanize schema matches the parameters above for each question type in your survey.