getodk / xforms-spec

The XForms-derived specification used in the ODK ecosystem. If you are interested in building a tool that is compliant with the forms rendered by ODK tools, this is the place to start. ✨⚒✨
https://getodk.github.io/xforms-spec/
31 stars 26 forks source link

How desirable is it to stick to the W3C XForms spec? #74

Closed lognaturel closed 6 years ago

lognaturel commented 7 years ago

I think interoperability between ODK tools is super valuable, especially for users in the ecosystem but also for developers. We've discussed this a bit in #73.

I think W3C XForms compatibility is desirable to the extent that it can help with design -- clearly a lot of smart people have already thought about how to express forms. We've talked some about compatibility with and possible code leveraging from tools like Orbeon Forms but I wonder how realistic that is given how much broader of a spec they implement.

What are the reasons we'd want to leverage the W3C XForms spec and how important of a criterion should this be when considering adding functionality? I believe @chrislrobert has decided with SurveyCTO that it's not a priority and that's a big reason there have been questions here about how to incorporate their extensions notably from @MartijnR . I believe Dimagi has decided that it is important to them and I'd like to hear more about that decision. @ctsims? Or is there someone else from Dimagi who could comment?

I want to have a clear sense of the arguments on both sides. I think having a relatively clear guiding principle related to this will help evaluate new proposals.

chrislrobert commented 7 years ago

My primary argument for essentially ignoring XForms compliance has been user experience: we want to add features in a way that's as easy as possible for users. And here, I mean "easy to use" to broadly include not just being simple to learn and use, but relatively efficient, not too error-prone, etc. Since users aren't coding in XML, we're generally concerned about their XLSForm (or drag-and-drop) experience -- but there are lots of ways that the underlying XML code influences those users. Primarily, constraint, relevance, and calculation expressions: we optimize functional forms for XLSForm, not for the underlying XForms. (Right now, XLSForm expressions are XForms expressions, except that ${name} references are expanded to XPaths automatically.)

My secondary argument concerns time/effort/cost. We're a small private business subjected to intense market pressures. The pressures are particularly intense specifically because we are a social enterprise focused on delivering a social mission. Our goal is to offer -- and support! for no extra charge! -- an incredibly stable and useful product for the lowest possible cost. So if we have 12 ways to implement something and one way is cheaper (considering long-term maintenance, support, documentation, etc., etc.), then generally we choose that way. This often pushes us away from XForms compliance because the costs of compliance have not seemed worth it (or relevant to our users).

Other issues that come up, very broadly related to ease-of-use, are backward-compatibility and upgrade-path. When we add functionality, we always try to do so in a manner that causes the least possible implications for backward compatibility, and we also try to make the pathway for existing users to benefit as short and as clear as possible. We have thousands of users to look after, and XForms-compliant designs often seem like total non-starters from the perspective of supporting those existing users.

And okay, if I'm being honest, a big practical issue is this: on our team, we have nobody who likes to modify that pyxform code. We're not python programmers, and even python programmers have a lot of trouble delving into that code. So we're trying to get some decent UX in XLSForm, and in principle we could do something nice in XLSForm (have to discuss that spec too, BTW!) and then have pyxform turn that into whatever XForms code is compliant. In principle that's okay, but in practice it takes us forever to modify that pyxform code, and we're terrified of breaking a zillion things all the while. So the reality is that we minimize the need for pyxform logic, which means keeping the XLSForm->XForms logic as unchanged as possible, while adding new functionality.

On Wed, Jan 11, 2017 at 5:47 PM, Hélène Martin notifications@github.com wrote:

I think interoperability between ODK tools is super valuable, especially for users in the ecosystem but also for developers. We've discussed this a bit in #73 https://github.com/opendatakit/xforms-spec/issues/73.

I think W3C XForms compatibility is desirable to the extent that it can help with design -- clearly a lot of smart people have already thought about how to express forms. We've talked some about compatibility with and possible code leveraging from tools like Orbeon Forms but I wonder how realistic that is given how much broader of a spec they implement.

What are the reasons we'd want to leverage the W3C XForms spec and how important of a consideration should this be when considering adding functionality? I believe @chrislrobert https://github.com/chrislrobert has decided with SurveyCTO that it's not a priority and that's a big reason there have been questions here about how to incorporate their extensions notably from @MartijnR https://github.com/MartijnR . I believe Dimagi has decided that it is important to them and I'd like to hear more about that decision. @ctsims https://github.com/ctsims? Or is there someone else from Dimagi who could comment?

I want to have a clear sense of the arguments on both sides. I think having a relatively clear guiding principle related to this will help evaluate new proposals.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/opendatakit/xforms-spec/issues/74, or mute the thread https://github.com/notifications/unsubscribe-auth/AIO0Hh5xDFd5m4dEkiDkrP35et2FsYrtks5rRVwegaJpZM4LhKkL .

dorey commented 7 years ago

Re- interoperability: at Kobo we have decided to build all of our surveys in a JSON representation of the XLSForm survey which compiles to a valid XForm with pyxform. We do not have any immediate plans to deviate from the standard, however the practical approach to implementing a custom question type (for example) would probably involve putting something directly into our form JSON, adapting the form builder + analysis tools to interpret that change, and proposing it to the greater odk/xform community once it is ready for broader adoption.

As for rolling out new XForm features, we would also need to work any changes into pyxform which presents the same obstacle that @chrislrobert described. (Though, I will vouch for the newer set of tests which ensures that important functionality remains intact.)

Re- W3C: I am not familiar with Odeon forms or XForm 2.0. Though there might be benefit in attempting to work with W3C to adapt their standard to match ODK/OR XForms, I would personally recommend shifting focus towards a XLSForm-JSON structure where the surveys are easier to build around than their corresponding XML surveys.

MartijnR commented 7 years ago

For me the idea behind managing this XForms specification is the interoperability of tools and a desire to grow the ecosystem not only by number of users but also by also by number of tools. I’d like the current 3 form engines get joined by another 3 form engines this year. I’d especially like to see more unique approaches (tools) for form builders and compliant data/form servers.

To get professionals interested in building (and adopting, and collaborating) we need solid specifications. Following (parts of) an actual W3C specification specification is the easy way to ensure that quality for exactly the reason @lognaturel mentioned.

The other reason for following XForms and in particular the XPath portion of it, is that it makes is so much easier to build robust tools for the OpenRosa/ODK ecosystem. From my own experience, I would have never been able to build Enketo without using an off-the-shelf XPath 1.0 evaluator and extending it. The same may be case for using off-the-shelf (parts of) XForms 1.x engines as well.

Deviating from (not extending) the XForms specification(s) is not out-of-the-question in my opinion, but we’d need a very good reason. So far, I don’t think there has been such a case and the major official deviation is a very unfortunate (accident) in my opinion.

@dorey, when replacing the XForms spec with the JSON spec, it makes sense to eventually remove the 2 translation steps (JSON -> XLSForm -> XForm) and build tools that directly support the JSON format, right? If not, we should keep the actual "spec" to be the XForms spec. Everything else is just pre-processing imo (to make our XForms easy to build).

dorey commented 7 years ago

^ yes I agree it makes sense to combine the steps into a single transformation which I think would be appropriate for a rewrite/port of pyxform to javascript which itself could be a useful tool for demonstrating this XML spec in the browser to newcomers.

lognaturel commented 7 years ago

Thank you @dorey, @chrislrobert, @MartijnR for the super helpful context.

My biggest takeaway is that we need to also discuss how to add on to and improve the XLSForms spec. There's probably a bunch of convenience functionality that could be added at that level. @chrislrobert mentioned a good example in something like in-range() which could help avoid off-by-one bugs when using <=/< and>=/>. It sounds like the new pyxform tests are a good step in making additions less challenging. I will do some poking around regarding how updates to XLSForms/pyxform are currently made and how we can unify the conversation a bit since changes here will require changes to XLSForms/pyxform to be useful for most end-users.

@chrislrobert did I understand correctly that you've been maintaining a pyxform fork for your users?

Another important thing is that there's a big difference between extending the W3C XForms spec, adding custom XPath functions, etc and reimplementing something structural with fundamentally different decisions. The latter is the thing to try hard to avoid as @MartijnR points out. I think we're all on board for that.

Not sure where to go from here. Perhaps looking at a couple of concrete functionality proposals with this discussion in mind would help get closer to more general guidelines?

chrislrobert commented 7 years ago

Yes, we maintain a pyxform fork -- and it sounds like the core has improved in significant ways beyond our fork (which is great). We've added a few columns and field types, we've added ${name} expansion in places like the appearance column (nod to @MartijnR here :), some hack to make within-repeat-group ${name} references work within choice_filter expressions, stuff like that.

On Thu, Jan 12, 2017 at 10:22 PM, Hélène Martin notifications@github.com wrote:

Thank you @dorey https://github.com/dorey, @chrislrobert https://github.com/chrislrobert, @MartijnR https://github.com/MartijnR for the super helpful context.

My biggest takeaway is that we need to also discuss how to add on to and improve the XLSForms spec. There's probably a bunch of convenience functionality that could be added at that level. @chrislrobert https://github.com/chrislrobert mentioned a good example in something like in-range() which could help avoid off-by-one bugs when using <=/< and

=/>. It sounds like the new pyxform tests are a good step in making additions less challenging. I will do some poking around regarding how updates to pyxform are currently made and how we can unify the conversation a bit since changes here will require changes to pyxform to be useful.

@chrislrobert https://github.com/chrislrobert did I understand correctly that you've been maintaining a pyxform fork for your users?

Another important thing is that there's a big difference between extending the W3C XForms spec, adding custom XPath functions, etc and reimplementing something structural with fundamentally different decisions. The latter is the thing to try hard to avoid as @MartijnR https://github.com/MartijnR points out. I think we're all on board for that.

Not sure where to go from here. Perhaps looking at a couple of concrete functionality proposals with this discussion in mind would help get closer to more general guidelines?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/opendatakit/xforms-spec/issues/74#issuecomment-272351346, or mute the thread https://github.com/notifications/unsubscribe-auth/AIO0HtYql43zyH2Wv5O8zU_fa6cTo6W_ks5rRu3tgaJpZM4LhKkL .

mberg commented 7 years ago

Just wanted to weigh in on this too.

For me the key importance to me about xlsforms (besides providing a useful way to author forms) is that it provides in my opinion the first practical way to share forms in a digital format. Ie) Our hope and you are starting to see it is groups like WHO share form standards not in word docs but in XLSForms.

XLSForms represent to me a key standard in how we architect and collect data. If we lose that ability I think it's a key loss.

I think PyXForm has been one of the better managed and community assets in ODK so I don't think it should be seen as an impediment. This is one of the key areas Ona is well suited to contributing too. It sounds like the SurveyCTO additions are helpful and is something work having in the spec that other platforms could eventually adopt. I think the key is getting back to having more formal discussions around the XLSForm spec (I realize this has started to happen over the past few months). If we are are able to formalize the new features collectively I'm confident we can update PyXForm to support it.

From Ona's side, we've added some new additions to the XLSForm spec that affect things more on the data appearance side. This includes the ability to yes the colors we assign to question options as they are represented in a map or chart ie) appearance: color=red for false for example.

I see these as optional parameters that don't break core functionality of XLSForms. There might be value in standardizing these if people want to be able to standardize how to interpret and visualize data captured in a specific type of form.

Summary - I care less about the underlying XForm spec. I think as a community I see XLSForms as the glue that holds us together and probably are most pragmatically useful way of exchanging forms. Heck even ESRI has adopted it and I don't know if they really on XForms for their tools.

Thanks,

Matt

On Fri, Jan 13, 2017 at 2:26 PM, chrislrobert notifications@github.com wrote:

Yes, we maintain a pyxform fork -- and it sounds like the core has improved in significant ways beyond our fork (which is great). We've added a few columns and field types, we've added ${name} expansion in places like the appearance column (nod to @MartijnR here :), some hack to make within-repeat-group ${name} references work within choice_filter expressions, stuff like that.

On Thu, Jan 12, 2017 at 10:22 PM, Hélène Martin notifications@github.com wrote:

Thank you @dorey https://github.com/dorey, @chrislrobert https://github.com/chrislrobert, @MartijnR < https://github.com/MartijnR> for the super helpful context.

My biggest takeaway is that we need to also discuss how to add on to and improve the XLSForms spec. There's probably a bunch of convenience functionality that could be added at that level. @chrislrobert https://github.com/chrislrobert mentioned a good example in something like in-range() which could help avoid off-by-one bugs when using <=/< and

=/>. It sounds like the new pyxform tests are a good step in making additions less challenging. I will do some poking around regarding how updates to pyxform are currently made and how we can unify the conversation a bit since changes here will require changes to pyxform to be useful.

@chrislrobert https://github.com/chrislrobert did I understand correctly that you've been maintaining a pyxform fork for your users?

Another important thing is that there's a big difference between extending the W3C XForms spec, adding custom XPath functions, etc and reimplementing something structural with fundamentally different decisions. The latter is the thing to try hard to avoid as @MartijnR <https://github.com/MartijnR

points out. I think we're all on board for that.

Not sure where to go from here. Perhaps looking at a couple of concrete functionality proposals with this discussion in mind would help get closer to more general guidelines?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/opendatakit/xforms-spec/issues/74#issuecomment- 272351346, or mute the thread https://github.com/notifications/unsubscribe- auth/AIO0HtYql43zyH2Wv5O8zU_fa6cTo6W_ks5rRu3tgaJpZM4LhKkL

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/opendatakit/xforms-spec/issues/74#issuecomment-272421928, or mute the thread https://github.com/notifications/unsubscribe-auth/AADiQc59MFyg7SJNGzNjX8reQaW05ff9ks5rR194gaJpZM4LhKkL .

MartijnR commented 7 years ago

@mberg XLSForms are totally great and important for building and exchanging forms, and without it our tools would have never become this popular. However, caring less about the underlying XForms spec may be because of your particular perspective which I think doesn't include directly improving low-level form engines inside data collection tools. As somebody who exclusively works on form engines and data collection tools, I can assure you it is the only important specification. I believe this is the same for all 3 form engines (JavaRosa, Enketo Core, Survey123).

XLSForms are user-focused and XForms are data-collection-client-focused.

ESRI has adopted it and I don't know if they really on XForms for their tools.

I believe they are and understand its importance. Esri has sponsored my recent PRs for this spec and also has been properly extending XLSForm with namespaced XML attributes.

@dorey, I actually meant disregarding XForms completely. No XForms, just JSON. If not, for the same reasons as above, the XForms format should remain the center of the ecosystem imo. The need for XLSForms to stay as @mberg argued, means it probably should be.

mberg commented 7 years ago

Martijn I understand that and wasn't trying to be dismissive. I agree with you and my focus certainly has been more on the macro level advantages of creating a standard and less on the underlying ways xforms work. I agree with sticking to standards if it enables better tooling. I still see an important role xlsforms paying as defining a common standard we should all aim to support which should translate to the xform spec. On Fri, Jan 13, 2017 at 8:11 PM Martijn van de Rijdt < notifications@github.com> wrote:

@mberg https://github.com/mberg XLSForms are totally great and important for building and exchanging forms, and without it our tools would have never become this popular, but caring less about the underlying XForms spec may be because of your particular perspective which I think doesn't include directly improving low-level form engines inside data collection tools. As somebody who exclusively works on form engines and data collection tools, I can assure you it is the only important specification. I believe this is the same for all 3 form engines (JavaRosa, Enketo Core, Survey123).

XLSForms are user-focused and XForms are data-collection-client-focused.

ESRI has adopted it and I don't know if they really on XForms for their tools.

I believe they are and understand its importance. Esri has sponsored my recent PRs for this spec and also has been properly extending XLSForm with namespaced XML attributes https://github.com/XLSForm/pyxform/issues/65.

@dorey https://github.com/dorey, I actually meant disregarding XForms immediately. No XForms, just JSON. If not, for the same reasons as above, the XForms format should remain the center of the ecosystem imo. The need for XLSForms to remain as @mberg https://github.com/mberg argued, means it probably should be.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/opendatakit/xforms-spec/issues/74#issuecomment-272492129, or mute the thread https://github.com/notifications/unsubscribe-auth/AADiQTrL-LY8jmJM2SCiTCcSWPHH9SBgks5rR7BbgaJpZM4LhKkL .

dorey commented 7 years ago

@chrislrobert , I did not mean to imply that pyxform core has significantly improved. It still has the same problems your python devs experienced. I would just say there's just better safety netting in case someone wants to take a chainsaw to it.

@mberg , I agree that the functionality of the library has evolved quite well, but the code itself has not. I would chalk this up to the fact that no one has been in a position to do a thorough restructure/rewrite because of how specific the original set of tests were.

lognaturel commented 7 years ago

You all are the best, this is very informative. Can we attempt to discuss new functionality proposals in terms of both specs? I think discussing the data-collection-client-focused and the user-focused at the same time could have many benefits.

@mberg, it's wonderful to hear that Ona can contribute on the XLSForms and pyxforms fronts. 🎉

MartijnR commented 6 years ago

I think our current approach to new features is fairly clear and robust now, so I think this issue can be closed. Please re-open if anybody likes to discuss this further.