-
Notifications
You must be signed in to change notification settings - Fork 137
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
Fixed <output> inside repeat has absolute path instead of relative #450
Conversation
Codecov Report
@@ Coverage Diff @@
## master enketo/enketo-core#450 +/- ##
==========================================
+ Coverage 83.11% 83.39% +0.27%
==========================================
Files 25 25
Lines 3595 3595
Branches 833 834 +1
==========================================
+ Hits 2988 2998 +10
+ Misses 460 454 -6
+ Partials 147 143 -4
Continue to review full report at Codecov.
|
Thanks @gushil, and OpenClinica, for stepping in so quickly! I've tried to break the fix with some black-box testing, and was not able to, so that's good. 👍 @ukanga this is the fix for the issue Ona reported recently. I'll add you as a reviewer, in case you have time (and to share the load with @lognaturel). I think, it would be great to get a fix merged soon, considering the problems this is causing for Enketo users. This is the kind of bug that is most urgent, because it is producing incorrect XForms and most (all?) servers don't have a way to automatically re-convert those forms to correct them. |
@ukanga, just pinging to check if you're able to look at this Ona-reported issue. :) |
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.
I've done an initial pass with a few questions and observations. Any more hints you can give to how you approached this, what you're confident about, what questions might have come up for you would be really helpful.
Thanks for your review @lognaturel! Just wanted to let you know OpenClinica has slightly delayed deploying the new pyxform version (they use a very old version), and I've heard @gushil may pick this up in a few weeks. |
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.
Added new commit that addressed some of the feedbacks above.
Thanks for the feedbacks @lognaturel !
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.
Thanks! This is making more sense to me. I think there's either some code you can cut down or some possible bugs. :D I've also made a couple of test suggestion.
@MartijnR I don't think there's anything in the spec that specifically addresses |
@lognaturel, you're referring to the output below, right? (using the test.xlsx form from that forum thread) <instance id="hm_name">
<root>
<item>
<filter>1</filter>
<label>${name1}</label><!-- uh oh -->
<name>1</name>
</item> I tried to figure out a syntax below. Not sure if I succeeded in that, and whether this implementable in pyxform. It wouldn't work in Enketo in the near future. It also wouldn't work for external instances, which to me is a fair argument to not support it all. It is extremely convoluted xlsform (and xform) syntax indeed. I agree that #38 would seem so much more sensible. <itext>
<text id="a1">
<value><output value="../name1"></value>
</text>
</itext>
<instance id="hm_name">
<root>
<item>
<filter>1</filter>
<itextId>a1</itextId>
<name>1</name>
</item>
...
<itemset nodeset="instance('hm_name')/root/item[filter < ( /data/qb_1 +1)]">
<value ref="name" />
<label ref="itext(itextId)" />
</itemset>
</select>
|
Oh LOL #403 |
Ahhh! I knew I'd seen something fly by related to this but couldn't think of where. Let's not worry about it here and instead try to get enketo/enketo#721 which would be really great. So I think this is very close to being ready. |
@lognaturel @MartijnR - I can't tell from the discussion above - will this update remove the existing behavior that allowed item references in choice labels? We have used this to very good effect (never in a translated form configuration). It is very helpful for allowing the user to (for example) associate a medication and an adverse event or associate a procedure with a previously identified tumor. In our experience, the only restriction we found was that we needed some text in the label other than the item reference itself. |
Can you please share a minimal XLSForm on enketo/enketo#434 that illustrates the pattern you want to use, @pbowen-oc? This PR doesn’t change existing behavior around this so let’s continue the conversation there. |
@lognaturel - Thanks, I have added an example file to enketo/enketo#434 |
Addressing feedbacks.
pyxform/survey.py
Outdated
@@ -743,15 +752,13 @@ def itext(self): | |||
) | |||
continue | |||
|
|||
if media_type == "long": | |||
value, output_inserted = self.insert_output_values(media_value) | |||
if media_type == "form": |
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.
I have to make changes to this line if I changed translation_key
to form
.
pyxform/survey.py
Outdated
@@ -593,7 +593,7 @@ def _setup_choice_translations(name, choice_value, itext_id): | |||
for d in element.get_translations(self.default_language): | |||
|
|||
translation_path = d["path"] | |||
translation_key = "long" | |||
translation_key = "form" |
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.
I meant changing the name of the variable to form
. long
and guidance
are values for the form attribute.
pyxform/survey_element.py
Outdated
@@ -271,6 +271,7 @@ def get_translations(self, default_language): | |||
for lang, text in constraint_msg.items(): | |||
yield { | |||
"path": self._translation_path("jr:constraintMsg"), | |||
"output_context": self, |
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.
Oh, great! There was a bug before because all of these need relative paths as well.
I took the liberty of renaming the variable that represents the translation form and adding tests for the additional translated columns. Unfortunately it looks like I forgot to run black and I had to quickly leave my computer so things are in a weird state. I’ll fix and merge this evening. Thanks for doing this and for taking my feedback, @gushil! |
enketo/enketo-core#446