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
Allow selection of multiple values per key from a list of options #103
Comments
It's also a feature in JOSM preset files btw, with semi-colon as the default separator; see http://wiki.openstreetmap.org/wiki/Customising_JOSM_Presets#Multiselect |
Do you have any ideas on how we want to specify in the XLS Form that a given OSM question can select multiple values? |
This sort of constraint needs to be specified in the XLS document. I'd rather not have to modify pyxform and JavaRosa further. They are bloated and cumbersome libraries that are hard to hack. Also, we will be having constraints beyond just this one, and I think there will be a fair amount of new logic we need to add to the XLS. Two options: XLS to JSON in NodeJSWe can use js-xlsx to convert the XLS document to JSON. This JSON can then be sent to the phone and read by OpenMapKit Android. Directly read XLS in OpenMapKit AndroidThis approach seems a bit more attractive to me, because we don't have another redundant file to store. We can use Apache POI to directly read the XLS file in OpenMapKit Android. Both libraries look good, however, the Java one looks mature and has stood the test of time. Also, it is very feature rich, not that that is important... It looks like maven has POI, so I should be able to just declare I want it in the gradle file. ChallengeThe thing we have to figure out is how we get the XLS file to the phone. Currently, ODK Collect downloads the XForm XML, but it does not get the XLS precursor. We don't want to change ODK Collect to be able to do this. That sort of approach would likely not be something UW maintainers would want to pull back in. That leads me to think we should provide the XLS file as part of a given deployment. Because we are downloading other things we need from the server, we might as well also get the XLS file too. This will then able us to begin building in constraint functionalities like this one. By having this feature be part of a deployment, this will mean that this feature will only work if we are using OpenMapKit Server. With other ODK Aggregates, we will have to fall back to not having new constraint features. I'm ok with this. This means we need to have another deployment sprint that implements getting the XLS file into a deployments directory on the phone. Thoughts? |
If HOT is time constrained, one thing we can do is provide them their own APK that just enables multiple selections for all multiple choice questions. |
For the moment & from my point of view, I don't actually care about the conversion process. I'm fine with just adding an attribute or something like that to the xml forms. So just having the facility in parsing the xml forms, and OMK itself would be absolutely fine with me. Then we can figure out how to represent this in the xls forms and convert this to xml later. For example:
|
I like your idea, however, this solution would still require mods to JavaRosa, because ODK Collect actually uses JavaRosa to parse and create objects from the XForms. Would enabling multiple select for everything be OK short term? I think parsing out XLS in OMK will be needed for the project as a whole. I could also parse XForms XML in OpenMapKit, but parsing XLS with Apache POI is super easy actually. |
Right. Discussed it here, and that would work for us indeed. We have some attributes/keys where this isn't useful (and can lead to people accidentally selecting multiple), but we can catch that quite easily in data review. On the rest of your approach text: provided you can still simply copy the (XLS) forms to the phone instead of being required to use OMK server, that sounds fine to me. It would mean you'd need to copy the xml to odk, and the corresponding xls to OMK though? Or can we avoid that? |
Right now XLSForms support select_one for OSM tags. Why not just add I think keeping OMK ODK compliant as much as possible is really important On Tue, Jan 5, 2016 at 10:00 AM, Paul Uithol notifications@github.com
|
As far as I'm aware, that applies to 'regular' odk survey questions - those have a constraints column that gets parsed. However, within a single osm/OMK question, you'll be collecting data for a number of attributes/keys - and there's no way to define constraints per attribute/key at the moment. See the attached examples, two of the forms we're using (out of 12). So this is about seeing how we can define constraints per attribute/key; making one value the default one, select one/multiple, numeric/text input, etc. |
Ah you're right sorry. Nick - would this need a change in javarosa or just pyxform? If it's On Tue, Jan 5, 2016 at 10:50 AM, Paul Uithol notifications@github.com
|
@mberg - Basically, adding support for
That's a lot of repos and different pieces to tackle for a feature like this. This can be done for sure, but this is not a good architecture for maintenance. @PaulUithol - I think you fully understand what's up regarding:
You are also correct that parsing the XLS for constraints does indeed require the XLS and XML to be on the phone. OMK Android would then directly parse the XLS. Basically, there is a lot of motivation to cut out all of these middle men. |
I think I'm going to work on this problem from the other end right now. I'm going to create a SelectMultipleTagValueFragment based off of SelectOneTagValueFragment. I can implement this UI and write semi-colon delimited values for OSM tags. I'll make a custom APK where this takes place of the radio buttons for HOT temporarily. This is the easy part, and with it in place, we'll be in a better spot to make the right decisions regarding how to get proper constraint parameters to OpenMapKit Android. Basically, we need to build the checkbox select multiple interface, and the approach on how we ship constraints to it is not going to affect this aspect of the implementation. |
Nick - could we define a standard/endpoint for serving up the form? that's I still think option 1 could make sense but i see how it adds a lot of On Tue, Jan 5, 2016 at 9:17 PM, Nicholas Hallahan notifications@github.com
|
@mberg - That's up to you. Please keep in mind that it is too prohibitive for me to work with proprietary software in context to this project. |
None of what i'm talking about is proprietary. This is about trying to If you are going to go direct to XLSForms then you are modifying the On Tue, Jan 5, 2016 at 9:33 PM, Nicholas Hallahan notifications@github.com
|
Out of curiosity on my part - to what extent is the |
xlsform.org is a community managed site and it's just that the OSM tag https://github.com/XLSForm/xlsform.github.io The current OSM features are both supported by pyxforms and javarosa. What On Tue, Jan 5, 2016 at 10:15 PM, Paul Uithol notifications@github.com
|
The other important thing to consider is there other odk complaint clients Adding that would be pretty much impossible to support or you abandon the On Tuesday, January 5, 2016, Matt Berg mberg@ona.io wrote:
|
I'm re-opening this issue, because it needs to be integrated with the |
Another would be opening hours
|
Ok, this feature is now working properly with constraints JSON. |
Proposal: to allow selection of multiple values for a single key (multiselect), yielding a semicolon delimited list of values. I'm not sure about how the semantics in the form, but that's something to discuss here ;)
Example: from a list of possible values for the
network
key on an ATM (as defined in the ODK/OMK form), selectMasterCard
,Visa
,MTN
, andAirtel
(this is one also offering mobile money services), resulting innetwork=MasterCard;Visa;Airtel;MTN
.The main use case currently for us is that in Uganda, we'd need to map the payment networks accessible through a single mobile money agent (as indicated above, also applies to ATMs).
Using semicolons in OSM keys is not always the right solution (it often isn't); but in this case, it most probably would be: both network values apply to the same POI (it shouldn't be split into multiple entities, as if it were four ATMs), and all values should be present (we can't just go with one or the other). Using all possible values as keys (say "MasterCard=yes", etc) wouldn't be the way to go either. Also see http://wiki.openstreetmap.org/wiki/Semi-colon_value_separator.
Here's a few more examples using semicolons to indicate multiple networks or another key:
Tanzania mobile money (we'll be adjusting our tagging for Uganda, since we need to distinguish more types of financial services there; also, use
network
instead ofoperator
):Belgian bus lines:
London under/overground:
The text was updated successfully, but these errors were encountered: