medic / cht-core

The CHT Core Framework makes it faster to build responsive, offline-first digital health apps that equip health workers to provide better care in their communities. It is a central resource of the Community Health Toolkit.
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
439 stars 211 forks source link

Add a native GPS field that can be required in the UI #6657

Open mrjones-plip opened 4 years ago

mrjones-plip commented 4 years ago

Is your feature request related to a problem? Please describe. Currently when you want to guarantee that a form has GPS coordinates gathered with it, you only have one option: add a enketo geopoint widget and make the input required. This is awkward, at best, because there is no good UI to indicate if the GPS is working and you should wait, let alone if the GPS is disabled and will never work. This is a pressing issue for the Covid MoH Mali (CMoHM) deployment where GPS is mandatory for all forms. The specifics of this issue are being worked on in config-moh-mali#86 .

Describe the solution you'd like Allow app builders to have a GPS input in the form be required. Allow them to give instructions to CHWs on how to use it. Make the input be intelligent so that when GPS is off it alerts the user, "You must turn on GPS to proceed" as well as give status updates like "Searching for GPS, please wait" and give the option to show a spinner. Upon success, allow a message to be shown "GPS coordinates found, you may proceed". Upon error show a message like "GPS coordinates could not be found. Please try again"

All text should be available for translation and extension (eg they may add "Please move to an area where you can see the sky and try again")

While there are some helpful changes in 3.10, they don't allow you to require the field. Here's the relevant description from 3.10 on GPS features for reference:

The app will wait up to 30 seconds to get a location lock before it gives up. If a user tries to submit a form before a location lock is obtained and before 30 seconds are up, the submit action will wait until 30 seconds are up. Also: This change also supports the latest updates in medic-android, where the Location permission is requested at runtime, when editing/creating a report, rather than demanded when starting the app for the first time.

Describe alternatives you've considered Currently the best work around we can do is to make the geopoint field required and then give the error message, "GPS coordinates not found, please ensure GPS is enabled and click the cross hairs to try again". This is awkward b/c GPS may be off and will never work no matter how many times the CHW clicks the cross hairs.

Additional context See config-moh-mali#86 NB - If this feature is tied to an upgrade to medic-android >0.4.39 (currently deployed version) there is very little rush. The reason is that any medic-android upgrade for CMoHM involves all 600+ CHW's returning their phones to a central location for upgrade. So, the only reason to consider rushing this feature would be if it can be done independent of medic-android and done entirely in cht-core and subsequently the CMoHM app.

garethbowen commented 4 years ago

There's also a data privacy improvement that might be related. Currently we automatically and silently (after the initial permissions request) collect GPS data on every report that is submitted. Some projects or workflows do not require GPS so it'd be better from a PII perspective to allow configurers to be able to specify which forms should collect GPS and which shouldn't. We could include a custom GPS widget to collect this information which displays location status in the UI while also allowing app builders to omit it from specific forms where the data is not required.