Add background-geopoint question type which exposes xforms-value-changed event with odk:setgeopoint action#726
Merged
lognaturel merged 8 commits intoXLSForm:masterfrom Oct 21, 2024
Conversation
Contributor
|
Thanks for this PR - looks like it will do what was agreed earlier. My comments are mainly to polish it: increase test coverage, optimise error messages, try to avoid performance regressions / tech debt. |
053647e to
8770059
Compare
Contributor
|
Thanks and welcome, @RuthShryock! |
|
Are there any further outstanding issues that need to be addressed to merge this PR? |
Contributor
|
@lindsay-stevens I've only taken a quick look and it's looking good. Could you please do a final review, especially looking at the perf concerns you had brought up? Maybe if there are smaller things pending we can file an follow-on issue as we sometimes do. Thanks! |
…an odk:setgeopoint action in response to an xforms-value-changed event
… name uniqueness in survey class
… setvalue question types and also when used in groups and repeats
- builder.py:
- de-duplicate elif call to create_question_from_dict
- use relevant class dictionaries directly instead of passing around
- replace regex with strip() to avoid replacing whitespace everywhere
in the question name (whitespace invalid in question names).
- question.py:
- avoid calling self.get_root() repeatedly as it iterates the form
(up the tree from the current question).
- remove `if` block in nest_set_nodes since it is only called when
there are items to be processed.
- question_types.py:
- add validation functions for workbook_to_json. used external strings
for re-use, easier testing, and (maybe someday) i18n.
- xls2json.py:
- move background-geopoint questions to workbook_to_json from
survey.py and question.py to allow row references in errors
- test_background_geopoint.py:
- change the test class name to match unittest idiom / test discovery
- remove `note` question from all tests since this is not relevant to
the feature being tested or any specific edge cases of interest.
- remove xpath expressions testing only the presence of groups, since
these are tested already as part of the xpath to find the inputs
within the groups.
- readability improvements:
- structured test method names
- state the overall test case expectation in docstring
- indicate the topic of the xpaths
- wrap long xpaths and use single-quotes for predicates
- shorten test fixture names and tidy up markdown formatting
153aa61 to
f673525
Compare
lindsay-stevens
approved these changes
Oct 19, 2024
Contributor
|
@lognaturel I added a commit to address the remaining review feedback. Could you please take a look and merge/rebase if it looks good to you? Thanks |
lognaturel
approved these changes
Oct 21, 2024
Contributor
|
Thanks, everyone! |
8 tasks
jnm
added a commit
to kobotoolbox/kpi
that referenced
this pull request
Nov 7, 2024
question type by upgrading pyxform to v2.2.0, which includes XLSForm/pyxform#726
jnm
added a commit
to kobotoolbox/kpi
that referenced
this pull request
Nov 7, 2024
### 📣 Summary Support the new `background-geopoint` question type [[read more]](XLSForm/pyxform#716) by upgrading pyxform to v2.2.0, which includes XLSForm/pyxform#726 ### 👀 Preview steps 1. Create a project by uploading an XLSForm with a `background-geopoint` question, for example ([Simple_background_geo.xlsx](https://github.com/user-attachments/files/17510897/Simple_background_geo.xlsx)) 1. Deploy the project 1. Download the project's XML XForm and verify it against the example here: XLSForm/pyxform#716 (comment).
RuthTurk
pushed a commit
to kobotoolbox/kpi
that referenced
this pull request
Jan 13, 2025
Support the new `background-geopoint` question type [[read more]](XLSForm/pyxform#716) by upgrading pyxform to v2.2.0, which includes XLSForm/pyxform#726 1. Create a project by uploading an XLSForm with a `background-geopoint` question, for example ([Simple_background_geo.xlsx](https://github.com/user-attachments/files/17510897/Simple_background_geo.xlsx)) 1. Deploy the project 1. Download the project's XML XForm and verify it against the example here: XLSForm/pyxform#716 (comment).
jnm
added a commit
to kobotoolbox/kpi
that referenced
this pull request
Jan 14, 2025
Support the new `background-geopoint` question type [[read more]](XLSForm/pyxform#716) by upgrading pyxform to v2.2.0, which includes XLSForm/pyxform#726 1. Create a project by uploading an XLSForm with a `background-geopoint` question, for example ([Simple_background_geo.xlsx](https://github.com/user-attachments/files/17510897/Simple_background_geo.xlsx)) 1. Deploy the project 1. Download the project's XML XForm and verify it against the example here: XLSForm/pyxform#716 (comment).
jnm
added a commit
to kobotoolbox/kpi
that referenced
this pull request
Jan 14, 2025
Support the new `background-geopoint` question type [[read more]](XLSForm/pyxform#716) by upgrading pyxform to v2.2.0, which includes XLSForm/pyxform#726 1. Create a project by uploading an XLSForm with a `background-geopoint` question, for example ([Simple_background_geo.xlsx](https://github.com/user-attachments/files/17510897/Simple_background_geo.xlsx)) 1. Deploy the project 1. Download the project's XML XForm and verify it against the example here: XLSForm/pyxform#716 (comment).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #716
Why is this the best possible solution? Were any other approaches considered?
This solution introduces a new
background-geopointquestion type that triggers theodk:setgeopointaction when thexforms-value-changedevent occurs. The design and implementation were based on discussions from this forum post. The solution followed the proposal and was straightforward to implement based on the details in the issue.What are the regression risks?
Because this introduces a new question type and modifies how
setvaluetriggers are handled, there is a risk of breaking existing workflows that rely on the currentsetvaluebehavior. I refactored some functions to handle bothsetvalueand the newsetgeopointtriggers, however, this needs to be tested thoroughly to ensure that the changes don’t break any of the existingsetvaluefunctionality.Does this change require updates to documentation?
Yes: XLSForm/xlsform.github.io#277
Before submitting this PR, please make sure you have:
testspython -m unittestand verified all tests passruff format pyxform testsandruff check pyxform teststo lint code