Skip to content

Insert itemset declaration for range labels#836

Merged
lognaturel merged 1 commit intoXLSForm:masterfrom
lognaturel:range-itemset
Apr 13, 2026
Merged

Insert itemset declaration for range labels#836
lognaturel merged 1 commit intoXLSForm:masterfrom
lognaturel:range-itemset

Conversation

@lognaturel
Copy link
Copy Markdown
Contributor

@lognaturel lognaturel commented Apr 11, 2026

Closes #835

Verified with Collect v2026.2.0 beta 1 using rangelabels.xlsx

Why is this the best possible solution? Were any other approaches considered?

In xls2json I ended up removing the tick_labelset parameter from the json representation and injecting an itemset using add_choices_info_to_question. That feels like a reasonable resulting json representation and a good way to reuse existing functionality.

For the conversion to xform, I considered whether I should reuse functionality between MultipleChoiceQuestion and RangeQuestion, maybe pulling out a mixin to represent having items. In the end I handled itemsets specifically for range because choices for selects are more complex. I think we may want to revisit this when we support reference geometry for geopoint/trace/shape which will also involve an itemset child.

I introduced a range_itemset testing function. It just checks the itemset declaration and not the label and value children, that didn't feel necessary.

What are the regression risks?

Limited to the range question type, probably really only around tick labels. Feels quite safe to me.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

Before submitting this PR, please make sure you have:

  • included test cases for core behavior and edge cases in tests
  • run python -m unittest and verified all tests pass
  • run ruff format pyxform tests and ruff check pyxform tests to lint code
  • verified that any code or assets from external sources are properly credited in comments

@lognaturel lognaturel requested a review from yanokwa April 11, 2026 18:20
@lognaturel lognaturel marked this pull request as ready for review April 11, 2026 18:20
Copy link
Copy Markdown
Contributor

@yanokwa yanokwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lognaturel lognaturel merged commit f28c0f6 into XLSForm:master Apr 13, 2026
14 checks passed
@lognaturel lognaturel deleted the range-itemset branch April 13, 2026 04:17
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.

Generate child itemset for range question with tick labelset

2 participants