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

Constraints #117

Closed
hallahan opened this Issue Jan 5, 2016 · 12 comments

Comments

Projects
None yet
3 participants
@hallahan
Contributor

hallahan commented Jan 5, 2016

This is the master issue for implementing constraint functionality. Here are the constraints we want to think about.

Multiple Values Per Key

Required Tags Force User To Answer

Implicit Tag Recorded Wihtout UI

Default Value for a Tag

Typeahead Based off of Tag Index

Skip Logic

Numeric Input

Enable / Disable Custom Value Input

Let's discuss here how we want to actually get constraint metadata into OpenMapKit Android so that we can do these things.

@PaulUithol

This comment has been minimized.

Show comment
Hide comment
@PaulUithol

PaulUithol Jan 7, 2016

Another one you might want to add is whether or not to show the 'custom' value input in addition to the predefined list. It's useful the vast majority of the time! - but sometimes, the answer should just be straight yes/no without the option for other values.

PaulUithol commented Jan 7, 2016

Another one you might want to add is whether or not to show the 'custom' value input in addition to the predefined list. It's useful the vast majority of the time! - but sometimes, the answer should just be straight yes/no without the option for other values.

@hallahan

This comment has been minimized.

Show comment
Hide comment
@hallahan

hallahan Jan 9, 2016

Contributor

Good call @PaulUithol. I will add it to the list.

Contributor

hallahan commented Jan 9, 2016

Good call @PaulUithol. I will add it to the list.

@hallahan

This comment has been minimized.

Show comment
Hide comment
@hallahan

hallahan Apr 5, 2016

Contributor

Thinking a bit about how the iD editor was built, constraints are built in as part of the UX. In fact, there are JSON configs determining how all of that stuff works.

If we have a certain OSM tag that merits a numeric input, or maybe skip logic determining what tags to ask for based off of previous answers, this is OSM specific, and it should be dictated by OSM best practices. These sort of constraints, I think, are universal in nature, and are a bit more default than something that should be declared in a specific form.

Maybe we should have a JSON config file that OpenMapKit Android looks at to determine OSM based constraints. This could be editable and served on an OMK Server endpoint, and we could also just pack a default in the app's assets.

I feel like this would serve well in the future if one were to make an OSM editor not associated with ODK. Also, if we really really absolutely had to integrate with pyxform and JavaRosa, it might make sense to compile constraints into this concept of a JSON config anyway.

Contributor

hallahan commented Apr 5, 2016

Thinking a bit about how the iD editor was built, constraints are built in as part of the UX. In fact, there are JSON configs determining how all of that stuff works.

If we have a certain OSM tag that merits a numeric input, or maybe skip logic determining what tags to ask for based off of previous answers, this is OSM specific, and it should be dictated by OSM best practices. These sort of constraints, I think, are universal in nature, and are a bit more default than something that should be declared in a specific form.

Maybe we should have a JSON config file that OpenMapKit Android looks at to determine OSM based constraints. This could be editable and served on an OMK Server endpoint, and we could also just pack a default in the app's assets.

I feel like this would serve well in the future if one were to make an OSM editor not associated with ODK. Also, if we really really absolutely had to integrate with pyxform and JavaRosa, it might make sense to compile constraints into this concept of a JSON config anyway.

@hallahan

This comment has been minimized.

Show comment
Hide comment
@hallahan

hallahan Apr 10, 2016

Contributor

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.

default.json - default constraints for all surveys
<form_id>.json - constraints that just apply to a specific form, overriding default.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.

cc/ @PaulUithol @dalekunce

Contributor

hallahan commented Apr 10, 2016

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.

default.json - default constraints for all surveys
<form_id>.json - constraints that just apply to a specific form, overriding default.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.

cc/ @PaulUithol @dalekunce

@dalekunce

This comment has been minimized.

Show comment
Hide comment
@dalekunce

dalekunce Apr 10, 2016

Member

+1 for this approach as long as the contraints.json can be easily made. Can we borrow anything from the iD or JOSM ontology to enforce stuff like this. Heck maybe maps.me even, there ontology looks pretty good as well.

Member

dalekunce commented Apr 10, 2016

+1 for this approach as long as the contraints.json can be easily made. Can we borrow anything from the iD or JOSM ontology to enforce stuff like this. Heck maybe maps.me even, there ontology looks pretty good as well.

@hallahan hallahan added the Epic label May 11, 2016

hallahan added a commit that referenced this issue May 13, 2016

hallahan added a commit that referenced this issue May 13, 2016

hallahan added a commit that referenced this issue May 16, 2016

hallahan added a commit that referenced this issue May 16, 2016

hallahan added a commit that referenced this issue May 16, 2016

#117 #148 Closes #21 - Numeric constraint for SelectMultipleTagValueF…
…ragment and SelectOneTagValueFragment

hallahan added a commit that referenced this issue May 16, 2016

hallahan added a commit that referenced this issue May 17, 2016

hallahan added a commit that referenced this issue May 19, 2016

#117 #37 Working on hideMap potion of tagShouldBeShown method. the hi…
…deMap was built backwards, restructured it to be like showMap.

hallahan added a commit that referenced this issue May 19, 2016

#117 #37 We actually really do need both types of hash indices. 1: Th…
…e tags that cause tags to be shown and 2: the tags with their constraints.

hallahan added a commit that referenced this issue May 20, 2016

#117 #37 Check for null reference in causeShowMap and causeHideMap - …
…not always tags that need to be shown / hidden

hallahan added a commit that referenced this issue May 20, 2016

#117 #37 Adds and removes dependent tags properly, but the radio butt…
…on does not toggle on first try anymore.

hallahan added a commit that referenced this issue May 20, 2016

#117 #37 Fix incorrect re-toggling of button when view implicitly rel…
…oads when mSectionsPagerAdapter.notifyDataSetChanged() is called

hallahan added a commit that referenced this issue May 20, 2016

hallahan added a commit that referenced this issue May 20, 2016

#117 #37 If tag edits get taken out and the index of the active view …
…changes, make it automatically pan to the currently active index.

hallahan added a commit that referenced this issue May 20, 2016

hallahan added a commit that referenced this issue May 20, 2016

hallahan added a commit that referenced this issue May 23, 2016

hallahan added a commit that referenced this issue May 28, 2016

@hallahan hallahan referenced this issue May 30, 2016

Merged

Constraints #155

@hallahan hallahan closed this in #155 May 30, 2016

@PaulUithol

This comment has been minimized.

Show comment
Hide comment
@PaulUithol

PaulUithol Jun 21, 2016

See this release is out now, great! I'm trying out some of the features,
and it does seem to make an educated guess as to the type of input
you're looking for? Some questions get an empty input for me, some
checkboxes, etc. Quite handy! Do you have an example of a constraints
json somewhere, showing of the features and how to use them? Or other
documentation on how to make these.

PaulUithol commented Jun 21, 2016

See this release is out now, great! I'm trying out some of the features,
and it does seem to make an educated guess as to the type of input
you're looking for? Some questions get an empty input for me, some
checkboxes, etc. Quite handy! Do you have an example of a constraints
json somewhere, showing of the features and how to use them? Or other
documentation on how to make these.

@dalekunce

This comment has been minimized.

Show comment
Hide comment
@PaulUithol

This comment has been minimized.

Show comment
Hide comment
@PaulUithol

PaulUithol Jun 21, 2016

Great, thanks! That's pretty elaborate.

Found the default.json. The constraints folder didn't show in file
explorer on my device for some reason, but there's the 'magic' behavior
happens then ;).

On 21-06-2016 17:37, Dale Kunce wrote:

http://openmapkit.org/docs_constraints.html

@PaulUithol https://github.com/PaulUithol


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#117 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAo7zpAA_y1uLhb38Vw8VRLin-O6Gakeks5qN_crgaJpZM4G_FRk.

PaulUithol commented Jun 21, 2016

Great, thanks! That's pretty elaborate.

Found the default.json. The constraints folder didn't show in file
explorer on my device for some reason, but there's the 'magic' behavior
happens then ;).

On 21-06-2016 17:37, Dale Kunce wrote:

http://openmapkit.org/docs_constraints.html

@PaulUithol https://github.com/PaulUithol


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#117 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAo7zpAA_y1uLhb38Vw8VRLin-O6Gakeks5qN_crgaJpZM4G_FRk.

@PaulUithol

This comment has been minimized.

Show comment
Hide comment
@PaulUithol

PaulUithol Jun 21, 2016

(sorry, I know I should open a new issue for this, but I can't login to
github.. something going wrong with timezones and two factor auth while
in Tanzania it seems)

Got a custom constraints file for a form to work with some fiddling, but
not quite according to the docs; these instruct to use the form title of
the form (not it's filename).

I tried a number of different names for the constraint file since it
wouldn't work, and the one that does it for me in this case is
hot_01_toilet.json, while the form title is <h:title>01 Toilets</h:title>. However, hot_01_toilet is the name of the form
file, and is also in the file as <instance><hot_01_toilet id="01_toilets">.

On 21-06-2016 17:45, Paul Uithol wrote:

Great, thanks! That's pretty elaborate.

Found the default.json. The constraints folder didn't show in file
explorer on my device for some reason, but there's the 'magic'
behavior happens then ;).

On 21-06-2016 17:37, Dale Kunce wrote:

http://openmapkit.org/docs_constraints.html

@PaulUithol https://github.com/PaulUithol


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#117 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAo7zpAA_y1uLhb38Vw8VRLin-O6Gakeks5qN_crgaJpZM4G_FRk.

Humanitarian OpenStreetMap Team
Project Manager "Ramani Huria" (Dar es Salaam) & "Mapping Financial Inclusion" (Uganda)

Email: paul.uithol@hotosm.org
Skype: paul.uithol
NL: +31 6 2423 7614
TZ: +255 7 8546 2836
UG: +256 7 8573 9853

PaulUithol commented Jun 21, 2016

(sorry, I know I should open a new issue for this, but I can't login to
github.. something going wrong with timezones and two factor auth while
in Tanzania it seems)

Got a custom constraints file for a form to work with some fiddling, but
not quite according to the docs; these instruct to use the form title of
the form (not it's filename).

I tried a number of different names for the constraint file since it
wouldn't work, and the one that does it for me in this case is
hot_01_toilet.json, while the form title is <h:title>01 Toilets</h:title>. However, hot_01_toilet is the name of the form
file, and is also in the file as <instance><hot_01_toilet id="01_toilets">.

On 21-06-2016 17:45, Paul Uithol wrote:

Great, thanks! That's pretty elaborate.

Found the default.json. The constraints folder didn't show in file
explorer on my device for some reason, but there's the 'magic'
behavior happens then ;).

On 21-06-2016 17:37, Dale Kunce wrote:

http://openmapkit.org/docs_constraints.html

@PaulUithol https://github.com/PaulUithol


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#117 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAo7zpAA_y1uLhb38Vw8VRLin-O6Gakeks5qN_crgaJpZM4G_FRk.

Humanitarian OpenStreetMap Team
Project Manager "Ramani Huria" (Dar es Salaam) & "Mapping Financial Inclusion" (Uganda)

Email: paul.uithol@hotosm.org
Skype: paul.uithol
NL: +31 6 2423 7614
TZ: +255 7 8546 2836
UG: +256 7 8573 9853

@hallahan

This comment has been minimized.

Show comment
Hide comment
@hallahan

hallahan Jun 22, 2016

Contributor

Hi @PaulUithol - could you send me your form? I'd like to take a look.

Contributor

hallahan commented Jun 22, 2016

Hi @PaulUithol - could you send me your form? I'd like to take a look.

@PaulUithol

This comment has been minimized.

Show comment
Hide comment
@PaulUithol

PaulUithol Jun 23, 2016

Will do as soon as I'm near a computer again. Must say I don't mind this
behavior though, if the docs were matching it. When dealing with large
amounts of forms, it'd be easier to see which belongs to which constraints
file if the filenames match, as opposed to having to open all the
spreadsheets searching for a match?
On Jun 22, 2016 8:54 PM, "Nicholas Hallahan" notifications@github.com
wrote:

Hi @PaulUithol https://github.com/PaulUithol - could you send me your
form? I'd like to take a look.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#117 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAo7ztegooD1kPqcU22d8yk3w9Qf5jjCks5qOXbmgaJpZM4G_FRk
.

PaulUithol commented Jun 23, 2016

Will do as soon as I'm near a computer again. Must say I don't mind this
behavior though, if the docs were matching it. When dealing with large
amounts of forms, it'd be easier to see which belongs to which constraints
file if the filenames match, as opposed to having to open all the
spreadsheets searching for a match?
On Jun 22, 2016 8:54 PM, "Nicholas Hallahan" notifications@github.com
wrote:

Hi @PaulUithol https://github.com/PaulUithol - could you send me your
form? I'd like to take a look.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#117 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAo7ztegooD1kPqcU22d8yk3w9Qf5jjCks5qOXbmgaJpZM4G_FRk
.

@hallahan

This comment has been minimized.

Show comment
Hide comment
@hallahan

hallahan Jun 23, 2016

Contributor

Totally. The reason is that the form title is the only thing available in the data structure in ODK Collect.

Contributor

hallahan commented Jun 23, 2016

Totally. The reason is that the form title is the only thing available in the data structure in ODK Collect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment