posm / OpenMapKitAndroid

http://openmapkit.org
BSD 3-Clause "New" or "Revised" License
128 stars 38 forks source link

constraints.json #148

Closed hallahan closed 8 years ago

hallahan commented 8 years ago

I'm breaking this comment out into an issue:

The basic approach with defining constraints will be JSON based. We copy JSON files form the constraints directory in the application assets to openmapkit/constraints in ExternalStorage. This way we will have a default setup, and then the constraints JSON settings can later be altered based on a REST endpoint in OpenMapKitServer (or a definition in XForms).

This approach is more extensible than building constraints into XForms up-front.

constraints.json - default constraints for all surveys _formid-constraints.json - constraints that just apply to a specific form, overriding constraints.json

We can implement the actual functionality of constraints in OpenMapKit Android via this JSON settings mechanism. Later, we can go in and build XLSForm (pyxform) -> XForm (JavaRosa) -> Constraint JSON.

Doing pyxform and JavaRosa work right now will derail progress in the project as a whole. Also, this approach would lend well for development of a tag editor outside of an ODK context.

By having a set of constraints settings files in the Android application assets, we will have good defaults ship with the app. We can then have a simple OpenMapKit Server REST endpoint with modified constraints, but we won't require OMK Server for constraint functionality to work in Android.

See 0d58f2a showing how we take app assets and move them to ExternalStorage, allowing us to not rely on republishing the app to update an assets setting file. @ccabanero & @shawnaparadee - you can use this code in TechTracker.

hallahan commented 8 years ago

This includes parsing the JSON and adding this functionality to the TagEdit model.

hallahan commented 8 years ago

Note to self: make sure constraint JSON files get loaded case insensitive.

hallahan commented 8 years ago

I'm going to close this when we have this documented.

hallahan commented 8 years ago

This has been completed and is documented at:

http://openmapkit.org/docs_constraints.html