enketo / enketo-validate

An ODK XForm validator around the Enketo form engine.
https://enketo.org
Apache License 2.0
3 stars 11 forks source link

Question: Difference between ODK and Enketo validate #39

Closed JohnHasthorpe closed 5 years ago

JohnHasthorpe commented 6 years ago

@MartijnR

We can see that the latest version of pyxform offers command line options to choose how the XForm XML is validated.usage: xls2xform [-h] [--json] [--skip_validate] [--odk_validate] [--enketo_validate] [--no_pretty_print] and it appears that ODK validation will not pass some of the functions described in https://docs.opendatakit.org/form-operators-functions such as count-non-empty().

We are hoping to better understand why there are two validators and which we should be using. Then, if required we would change the Survey123 conversion API to use the most appropriate one.

Any information would be appreciated. Thanks

MartijnR commented 6 years ago

Both validators should be compliant with ODK XForms spec, but due to bugs and delays, they may not alway be equally compliant.

The reason we created Enketo Validate was to cater to including custom XPath functions by Enketo-adopters and being able to circumvent particular Javarosa quirks for those adopters (that don't actually use javarosa clients). More here: https://github.com/XLSForm/pyxform/issues/163. Enketo's XPath evaluator is easily extendible with custom functions, and those can be easily added to this library/tool as well.

I think having a non-Java validator by itself is very helpful for the ecosystem. The reason this library was also added to pyxform is to provide an additional option. It's not actually downloaded by default though.

There are a lot of things that ODK Validate will pick up and Enketo Validate will not pick up and vice versa. So the decision on which to pick may require some testing. However, since Esri is also not using Javarosa, it seems to make sense to switch to enketo-validate at some point (perhaps after adding any checks you'd like to add). Please add any issues you find!

Here is a web interface for both ODK Validate and Enketo Validate for developer testing purposes: https://validate.enketo.org/ (we could add pyxform to this if needed).

MartijnR commented 6 years ago

One positive difference in Enketo validate is that it will evaluate all XPath expressions and return all errors (instead of just the first error). Test with https://raw.githubusercontent.com/enketo/enketo-validate/master/test/xform/xpath-fails.xml

JohnHasthorpe commented 6 years ago

@MartijnR Thanks - very helpful