Repository navigation
Description
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), select MasterCard, Visa, MTN, and Airtel (this is one also offering mobile money services), resulting in network=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 of operator):
<node id="3766196144" lat="-6.8225067" lon="39.2773854">
<tag k="amenity" v="money_transfer"/>
<tag k="operator" v="Airtel-Money;M-Pesa;Tigo-Pesa"/>
</node>
Belgian bus lines:
<node id="2619430757" lat="50.8492063" lon="4.3258571">
<tag k="bus" v="yes"/>
<tag k="highway" v="bus_stop"/>
<tag k="name" v="Quatre-Vents - Vier Winden"/>
<tag k="name:fr" v="Quatre-Vents"/>
<tag k="name:nl" v="Vier Winden"/>
<tag k="network" v="DLVB;IBXL"/>
<tag k="operator" v="De Lijn;STIB/MIVB"/>
<tag k="public_transport" v="platform"/>
<tag k="railway" v="tram_stop"/>
<tag k="ref:De_Lijn" v="301066"/>
<tag k="route_ref" v="82"/>
<tag k="route_ref:De_Lijn" v="126;127;128"/>
<tag k="tram" v="yes"/>
<tag k="zone:De_Lijn" v="20"/>
</node>
London under/overground:
<node id="11249226" lat="51.3971534" lon="-0.0746248">
<tag k="name" v="Norwood Junction"/>
<tag k="naptan:AtcoCode" v="9100NORWDJ"/>
<tag k="network" v="National Rail;London Overground"/>
<tag k="railway" v="station"/>
<tag k="ref" v="NWD"/>
<tag k="source_ref" v="http://en.wikipedia.org/wiki/London_Overground#Stations"/>
<tag k="wikipedia" v="en:Norwood Junction railway station"/>
</node>
Activity
PaulUithol commentedon Dec 28, 2015
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
hallahan commentedon Jan 5, 2016
Do you have any ideas on how we want to specify in the XLS Form that a given OSM question can select multiple values?
cc/ @dalekunce @PaulUithol
hallahan commentedon Jan 5, 2016
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 NodeJS
We 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 Android
This 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.
Challenge
The 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?
hallahan commentedon Jan 5, 2016
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.
PaulUithol commentedon Jan 5, 2016
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:
hallahan commentedon Jan 5, 2016
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.
PaulUithol commentedon Jan 5, 2016
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?
mberg commentedon Jan 5, 2016
Right now XLSForms support select_one for OSM tags. Why not just add
support for select_multiple? Or is this something different that I'm not
understanding properly.
I think keeping OMK ODK compliant as much as possible is really important
for the broader adoption of the tool.
On Tue, Jan 5, 2016 at 10:00 AM, Paul Uithol notifications@github.com
wrote:
PaulUithol commentedon Jan 5, 2016
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.
hot_03_atm.xlsx
hot_01_mobile_money.xlsx
mberg commentedon Jan 5, 2016
Ah you're right sorry.
Nick - would this need a change in javarosa or just pyxform? If it's
pyxform we can help make the change if we can figure out the right syntax.
On Tue, Jan 5, 2016 at 10:50 AM, Paul Uithol notifications@github.com
wrote:
hallahan commentedon Jan 5, 2016
@mberg - Basically, adding support for
select_multiplewould require work in: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.
hallahan commentedon Jan 5, 2016
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.
mberg commentedon Jan 5, 2016
Nick - could we define a standard/endpoint for serving up the form? that's
something that ODK compliant servers could also probably support relatively
easily.
I still think option 1 could make sense but i see how it adds a lot of
complexity for something that is OMK specific
On Tue, Jan 5, 2016 at 9:17 PM, Nicholas Hallahan notifications@github.com
wrote:
5 remaining items
basic fragment #103
tag key and tag label text views are populated #103
checkboxes are populated with values #103
almost there, i'm not getting unique IDs for the checkboxes, so i nee…
semi colon delimited values working #103
writing semicolon values in xml almost working correctly #103
v0.15 Multiple Tag Value Feature. Closes #103
hallahan commentedon May 11, 2016
I'm re-opening this issue, because it needs to be integrated with the
constraint.jsonmechanism. Right now it's hard-coded and requires a custom build. Obviously, we want to do this right.hallahan commentedon May 11, 2016
Another would be opening hours
#117 Some default JSON for select_multiple #103
#151 Select Multiple view shows up based off of select_multiple const…
hallahan commentedon May 30, 2016
Ok, this feature is now working properly with constraints JSON.