I think if we can specify exactly (like in a document) how the Open
Rosa specification differs from the XForms one that would be a good
step forward for us. We can then extract this diff and just apply it
to the new model if/when this comes around.
Great discussions b.t.w - love the couchapp idea and moving to dynamic
for creation on devices
Regards
> 1) What are the primary issues people are having with the XForms standard?
i'll let others speak for themselves, but i'd like to be on the right technology trend, and pretty much no one uses xforms (except for orbeon). it's huge and hard to understand and it seems like we are always forcing our ideas to make everything fit that model. as people take different approaches, we have also quickly diverged from each other, making the whole notion of a standard useless.
> 2) Are there limitations in terms of what one can do with XForms that you're running into?
some of my complaints are tied to javarosa. i'd like to try gotos, instead of relevancy. i'd like to support gigantic forms thru lazy loading. i'd like to pull values from a database and filter on them. i'd like to support custom ui per form and per widget. and i'd like the form design to be more lightweight and human-understandable. there are more complaints in the thread i attached. are you guys at dimagi happy with xforms?
> 3) What kind of form spec, would you say, are people leaning towards? Pure programming language (e.g. everything written in JS), some other form standard, something else?
the consensus seems to be forming around the html5 form spec with additions through javascript for the base case. mike mckay's touchscreen toolkit has a good pass at this. jquery mobile also has some of this functionality as well. as far the complex forms, no idea. my gut says javascript. code that runs natively in a browser feels like the right approach.
> 4) Will this new tech be more complex than XForms or something more basic (but easier to use)?
i think we want to optimize for ease of use for developers and users. we have a good sense of the common case of forms and we just want to make that super easy. at the same time, we want to make complex things like eimci possible. i dunno if you've looked at that form, but it's a mess. there has to be a better way...
> 5) Will you be migrating all the ODK tools to this new spec by modifying the existing tools/backends or re-write from scratch?
this is more gaetano's call and we haven't talked about it in detail. personally, i'd like to see us switch to maintenance mode on the existing tools and start fresh with this new spec.
I'd like to chime in here and say that I'm excited about the direction
that this and previous discussions are headed. Our company has a data
collection solution based on ODK Collect and CouchDB (groupcomplete.com)
that focuses on making data gathering a collaborative experience. Like
Collect, our app is native to Android but we are experimenting with web
frontends.
I cannot stress enough, as others have already done, how important
CouchDB is to the future of data collection. It's replication and
ability to operate on mobile platforms are key. As far as I know we
were the first company that based a product on Couch residing on the
mobile device (I know Dimagi has done similar work with Couch but I'm
not sure that it was on the smartphone per-se). We've been intimately
involved with helping to bring Couch to Android and at no point have we
regretted the decision to base our solution on it.
With respect to XForms, compatibility moving forwards would be of
interest to us and no doubt to others as well. I know that people have
expressed concerns about its limitations and trouble extending it as
time goes on but I am hesitant to throw the baby out with the bathwater.
JavaRosa XForms is an important part of a lot of implementations,
toolkits and processes (some publicly known and others internal to
various organizations and businesses that have adopted it) and I think
that it makes sense to consider the impact of transitioning away from a
technology that has fairly wide use. Some kind of one-way or
bi-directional bridge between XForms and next-gen would be useful. I'm
sure that the guys at Dimagi are thinking about this.
Radical would like to commit resources either in the form of active
development, testing and/or bugfixes to this and similar endeavours by
other teams. I think that it will help the community immensely to focus
efforts on one or two solutions much like JavaRosa/ODK have done. I
recall Yaw mentioning an approach that the ODK team is working on but I
don't know what the status of it is.
Cheers,
Matt
--
Matt Adams
Radical Dynamic
www.radicaldynamic.com
3) Anton is just about to release an alpha of the pure javascript/Jquery (X)form authoring tool he has been working on. We should evaluate the Javascript and JSON object representation of his code, make adjustments as necessary, and use that as our basis for shared form definitions. One could then export just as JSON, convert to XForms, or whatever.
2) CouchForms (https://github.com/dimagi/couchforms) is what we use as the back-end couch repository for forms. This is currently the back-end for two production systems: both the system Cory blogged about in Zambia with local replication, as well as CommCareHQ in use in over 10 countries and 20 organizations.
We've been intimately
involved with helping to bring Couch to Android and at no point have we
regretted the decision to base our solution on it.
Radical would like to commit resources either in the form of active
development, testing and/or bugfixes to this and similar endeavours by
other teams. I think that it will help the community immensely to focus
efforts on one or two solutions much like JavaRosa/ODK have done. I
recall Yaw mentioning an approach that the ODK team is working on but I
don't know what the status of it is.
3) Anton is just about to release an alpha of the pure javascript/Jquery (X)form authoring tool he has been working on. We should evaluate the Javascript and JSON object representation of his code, make adjustments as necessary, and use that as our basis for shared form definitions. One could then export just as JSON, convert to XForms, or whatever.We'd love to help out with this tool as some kind of a pure javascript form editor is on our todo list. Anton - is this in a state where you could use some help? Github it up!
2) CouchForms (https://github.com/dimagi/couchforms) is what we use as the back-end couch repository for forms. This is currently the back-end for two production systems: both the system Cory blogged about in Zambia with local replication, as well as CommCareHQ in use in over 10 countries and 20 organizations.CouchForms sounds great. It would be awesome if we could get have that functionality entirely encapsulated in a CouchDB instance and nothing else. Removing the python dependency would mean that creating a repository would be as simple as setting up a free account at http://www.iriscouch.com/ or https://cloudant.com/#!/solutions and then replicating the CouchApp into it. Crazy?
> Sounds like we're mostly in agreement on everything here which is great.
> I am a strong proponent of a JSON form definition standard (hopefully
> shared between ODK's tools and Anton's Form Designer) with no
> dependencies on couch.
For what it's worth I agree with these ideas, although I haven't had
time to look at Anton's Form Designer yet.
link controls to data (local stuff like defaults and maybe a remote db)
logic for branching (basic jumps and e-imci style)
multiple questions per screen (android tablets are getting cheap)
do calculation across various nodes (if i enter a birthdate, i wanna
calculate age in months)
looping across a node n times (i enter that i have five kids, and i
want five child repeats)
totally custom controls (say a select one that looks like
http://opendatakit.org/wp-content/uploads/2011/07/plotType.png)
no flame retardant suit needed here. curious how will you imagine
doing the following...
link controls to data (local stuff like defaults and maybe a remote db)
logic for branching (basic jumps and e-imci style)
multiple questions per screen (android tablets are getting cheap)
do calculation across various nodes (if i enter a birthdate, i wanna
calculate age in months)
looping across a node n times (i enter that i have five kids, and i
want five child repeats)
totally custom controls (say a select one that looks like
http://opendatakit.org/wp-content/uploads/2011/07/plotType.png)
some other questions i've had...
huge forms (and thus huge form defs) is something javarosa struggles
with. it'd be great if we had some discussion on how to load forms
sequentially or how to link forms together.
any concern that we are not separating out the data and the logic on
the json? everyone ok with all that stuff sitting in one place?
thoughts on having a standard list of prompt types and data types and
attributes? if not, how do we ensure that forms work across platforms?
is it reasonable to ask for hidden nodes -- variables that can store
temporary data that are either globally or locally available?
if we are going to build this new form processor in backbone.js (or
some other equally hip framework), how will all this get to native
apis on android? how do i scan a barcode? or get the imei number? or
pull from a sqlite db on the phone?
if we are going to build this new form processor in backbone.js (or
some other equally hip framework), how will all this get to native
apis on android? how do i scan a barcode? or get the imei number? or
pull from a sqlite db on the phone?
> Looks like you'll be able to execute JS in your android app using WebViews,
> you content can be dynamically generated by your app, so you may be able to
> build some sort of a bridge between hardware/sqlitedb and the js-web-app
> thing.
You can use WebViews together with phonegap which makes it possible to
call Java methods from Javascript on Android
For example I call the android camera in this example jquery mobile
and sqlite app (about finding and rating cachaça :) )
http://ianlawrence.info/downloads/bafo-de-tigre/index.html
Regards
any concern that we are not separating out the data and the logic on
the json? everyone ok with all that stuff sitting in one place?
>> any concern that we are not separating out the data and the logic on
>> the json? everyone ok with all that stuff sitting in one place?
>>
>
> i'm not ok with the relevancy model of attaching conditions to individual
> questions that turns them on or off (if that's what you're referring to). my
> experience with xforms has shown me that model is COMPLETELY inadequate for
> any moderately branchy form. in this model it is also very hard to do 'if X
> go to end of form'. it has a place for simple forms (and simpler sub-parts
> of complex forms), and i don't think we should do away with it. but any new
> spec we come up with that hopes to improve upon xforms must have an innate
> concept of branching. (and probably other control flow constructs as well,
> such as 'loop until condition is satisfied').
we are also likely conflating weaknesses in javarosa-core with
weaknesses in xforms (which can do some pretty cool stuff...even in a
browser. see http://www.orbeon.com/forms/compare). can we be explicit
on this? have people who've read most of the xforms spec really think
we can do better? if xforms is terrible, why is this new thing json
thing better?
if i had to make a decision today, i'd say that xforms is likely fine,
javarosa-core is not, and we'd be better served taking a deeper look
at xforms and maybe building a better core. if the problem isn't
xforms, but more of the weakness of a declarative form description,
then we need to reframe much of this discussion to the procedural (or
hybrid) approach that gaetano and drew are suggesting...
My problems with XForms are the following:
1. Scattering of question properties into different parts of the form
(instance, bind, and body) making it difficult to cut/paste sections
and easily reason about form logic flow.
2. Difficulty in extending with new functionality (read arbitrary
code, when needed by experienced users).
3. Declarative vs. procedural form logic flow which I believe to be
more difficult for the average person to grasp (Drew's example is much
more readable, for example).
There are even more problems with Javarosa-core, but those could be
surmounted more easily than the XForm issues.
I'd like to propose something much more object-oriented where forms
and questions are objects.
A form has a collection of variables and a collection of questions.
The questions are arranged into pages, pages have a sequential default order.
A page is another object, and it can determine what the next page is
(basing its determination on the value of variables).
A question has a type, constraints, and calculations.
When a form is loaded, it is asked for its first page to display.
Each question on the page is asked its type (default behavior) and
asked to display itself - question text can be determined on the fly
although default behavior will be to have a string specified for this,
similarly, for any default values.
Whenever the user changes a value in an entry on a page, that
question's calculation method is invoked (default is null) so that any
variables can be updated. A page's display is refreshed if any
question on that page "watches" a variable that is updated.
Variables are updated through a method invocation as well and
questions/pages can register to "watch" a variable.
Whenever the user attempts to advance to the next page, all questions'
constraints are checked (default is a null constraint that is always
satisfied) and the question returns a warning to display if the
constraint is violated preventing moving to the next page.
Also, when the user attempts to advance to the next page, a method is
invoked on the form to determine the next page. The default method
advances through pages sequentially while a specialized method may
include a flow (such as Drew's).
There are no "repeats", rather a repeated series of questions is
simply another form. Thus, a form's next page, may be another form.
A stack is maintained to by the form renderer to keep track of which
form/subform it is currently in.
Pages are not just for question collections. Some pages may be used
to present data to the user, e.g., display a graph of data, summarize
other data, etc. Also, a submission is a type of page where variable
values are collected and packaged for shipping - over a data channel,
to storage/db, or to SMS.
Most question renderings will be built-in, others will be used to
invoke external applications for special data gathering (e.g., bar
code, photo, sensor data, etc.).
The idea is that, most of the time, a form and its pages and questions
will use default methods. However, these methods can be overridden
with specialized arbitrary code for easy extension and customization.
Here is a simple, three page form with a question depending on the
answer to another:
Form:
variables va, vb, vc, vd
pages pa, pb, pc
questions qa, qb, qc, qd, qe
Pages:
pa: qa
pa/next: if va < 10 pb else pb2
pb: qb, qc, qd
pb2: qc, qd
pc: qe
Questions:
qa: number
qa/text: enter a number
qa/constraint: if number <= 5 warn "enter a number > 5"
qa/variable: va
qb: text
qb/text: enter a string
qb/variable: vb
qc: photo
qc/text: take a photo
qc/variable: vc
qd: location
qd/text: where did you take this picture?
qd/variable: vd
qe: text
qe/text: "your previous answer was " + vb + ", please amend it"
qe/default: vb
qe/variable: vb
I can't vouch for the efficiency of doing it this way, but it seems
like a well-structured approach (at least to me, but isn't that always
the case with one's own ideas?). Of course, the syntax could be your
favorite - JSON, XML, etc.
Thoughts?
Gaetano