Skip to content

Improve QSF parser with better Qualtrics piping conversion and question ordering#2354

Open
johnjosephhorton wants to merge 2 commits intomainfrom
feature/improve-qsf-piping-conversion
Open

Improve QSF parser with better Qualtrics piping conversion and question ordering#2354
johnjosephhorton wants to merge 2 commits intomainfrom
feature/improve-qsf-piping-conversion

Conversation

@johnjosephhorton
Copy link
Collaborator

Summary

  • Add improved Qualtrics piping syntax conversion with better variable name mapping
  • Implement question ordering based on QSF flow/block structure to preserve original survey order
  • Add comprehensive piping conversion that handles question text, choice text, and scale text

Key Changes

  • New convert_qualtrics_piping_to_edsl() function: Converts Qualtrics piping patterns like ${q://QID1/ChoiceGroup/SelectedChoices} to EDSL format {{ variable_name.answer }}
  • New _order_questions_by_flow() method: Preserves original QSF question ordering by following the flow/block structure instead of using arbitrary dictionary ordering
  • New _apply_improved_piping_conversion() method: Uses QID to export tag mapping for more accurate variable name conversion, processes all text fields (questions, choices, scales)
  • Updated main parse() method: Integrates the new ordering and piping conversion functionality

Benefits

  • Better UX: Surveys maintain their original question order when imported from Qualtrics QSF files
  • Improved accuracy: Piping references use proper export tags/variable names instead of raw QIDs
  • More robust: Handles piping in all text contexts (question text, choice text, scale text)

Test plan

  • Verify QSF files with Qualtrics piping are correctly converted to EDSL piping syntax
  • Confirm question ordering matches the original Qualtrics survey structure
  • Test with various QSF file structures (different flow types, nested blocks)
  • Validate that existing QSF parsing functionality remains unchanged for files without piping

🤖 Generated with Claude Code

johnjosephhorton and others added 2 commits December 18, 2025 12:33
…on ordering

- Add convert_qualtrics_piping_to_edsl() function for better piping syntax conversion
- Add _order_questions_by_flow() to preserve original QSF question ordering based on flow/block structure
- Add _apply_improved_piping_conversion() with QID to export tag mapping for more accurate variable name conversion
- Update parse() method to use the improved ordering and piping conversion
- Add comments indicating where piping conversion is applied in the parsing flow

These improvements ensure that Qualtrics surveys imported via QSF maintain their original question order and have more accurate variable name mapping for piped text references.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants