Maps a Qualtrics QuestionType / Selector / SubSelector combination to a
standardised question type and extracts the structural fields the burden
scorer needs. This function reads structure only, never semantics: a two-option
multiple choice is single_choice whether it means yes/no or something else.
Value
A named list with elements question_id, std_type,
qualtrics_type, selector, subselector,
is_dropdown (TRUE for single-choice dropdowns),
is_multiline (TRUE for multi-line open text),
is_multi_answer (TRUE for checkbox-per-cell matrices),
n_options, n_rows,
n_cols, text_words, max_label_words (longest response option / matrix
label, in words; NA if the question has no labels), label_text (all
response/answer labels lowercased and joined with " | ", truncated; NA
if none), options_numeric (TRUE if the question has >= 3 response
options and every one is a number), question_text (HTML-stripped,
truncated to 200 characters), is_hidden (TRUE if injected CSS/JS hides
the question from the respondent), has_display_logic,
display_logic_refs (character vector), has_validation and flag.
parse_qsf() assembles one tibble from these across every live question.
Details
flag is one of "auto" (confident structural mapping),
"inferred" (mapping needs an assumption, e.g. dropdown scored by option
count, short text that might be a code field), "manual" (reserved for cases
a human must check) or "unknown" (unmapped type).
Examples
qsf_path <- system.file("extdata", "demo_travel_survey.qsf",
package = "surveyBurden")
qsf <- read_qsf(qsf_path)
questions <- Filter(function(el) identical(el$Element, "SQ"),
qsf$SurveyElements)
cls <- classify_question(questions[[1]]$Payload)
cls$std_type
#> [1] "descriptive"
cls$n_options
#> [1] 0