-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add initial support for entities #624
Conversation
From a quick check, we are not using it directly as a public API. More checks are needed on my end but nothing should hold this work back from our end. |
Thanks, @ukanga! If you find there’s an issue, we can make changes, even if it’s after an initial release. |
| entities | | | | | ||
| | dataset | | | | ||
| | trees | | | | ||
| | shovels | | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it important that this specific error is displayed when the label
column is missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error is because there are multiple entities declared. That gets checked before the label. https://github.com/XLSForm/pyxform/pull/624/files#diff-757cf40dfe1058a66a7d6603bb35a2ea70614e7df312df390058c21c4e9c0c62R206 tests that labels are required.
Unclear to me whether these tests verify an API that's intended to be public or just represent an earlier attempt at unit testing. This may point to an issue with the Survey.xml_bindings change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for the mention, @lognaturel. I don't foresee any problems. |
@lognaturel I know this is merged and released but just checking if you still want me to review this per your slack message? |
Thanks, @lindsay-stevens! There are two things that I think would be helpful to get your feedback on:
High-level, I really tried not to make things messier and I want to confirm I achieved that. I'm also interested in whether you see any patterns we could/should reuse and/or any missed opportunities to lay useful groundwork. |
@lognaturel looks good to me. Some suggestions/notes
|
Closes #622
Why is this the best possible solution? Were any other approaches considered?
This adds the desired support without increasing the size of
workbook_to_json
. It keeps the entities functionality relatively isolated which aligns well with the idea that this is an optional, experimental spec addition.The
entity
node in the main instance has several attributes that each have bindings. I kept the JSON representation simple by using the existingparameters
dictionary for the various aspects of entities that can be configured. Then I introduced aEntityDeclaration
SurveyElement
to create the attributes and their bindings. That feels better to me than trying to get an XForms-like representation in the json.What are the regression risks?
I changed
Survey
to get the multiple bindings for a single form element. There used to be axml_binding
method for the current survey element's binding andxml_bindings
for the bindings of the current element and descendants. I now havexml_bindings
for the current survey element's possibly multiple bindings andxml_descendent_bindings
for the bindings of the current element and descendants. I don't think there are regression risks but there's a chance this is being used as a public API. @ukanga @jnm any issues from your ends?Does this change require updates to documentation? If so, please file an issue here and include the link below.
XLSForm/xlsform.github.io#232
Before submitting this PR, please make sure you have:
tests
nosetests
and verified all tests passblack pyxform tests
to format code