Django Data Collection tool using ODK Collect mobile App
Project description
django-odk
Django data collection tool using ODK-collect mobile app.
Prerequisite
- Django web site up and running
- Smartphone or tablet with ODK-Collect installed
- Set of forms in Xforms format available in xml. Use https://getodk.org/xlsform/ to validate and export your forms in xml format.
- Database up & running with vector geodatabase functionality (if your ODK form use geopoint): PostGIS, Oracle Spatial, SQLite/SpatiaLite
Installation
- Run
$ pip install django-odk
$ python manage.py migrate
$ python manage.py createsuperuser
- Add odk and odkdata to your INSTALLED_APPS settings
INSTALLED_APPS = (
...
'odk',
'odkdata',
)
- Add LOCALE_PATHS and appropriate language_code in settings
LOCALE_PATHS = [os.path.join(BASE_DIR, 'odk', 'locale')]
LANGUAGE_CODE = 'en'
# LANGUAGE_CODE = 'fr'
# possible LANGUAGE_CODE on 05/10/2021 are: en, fr
- Add appropriate AUTH_USER_MODEL in settings.py
AUTH_USER_MODEL = 'auth.user'
-
For a more interactive app, configure logging as explained in Lincoln Loop and messages as explained in Django
-
Add is_odk_admin property to your AUTH_USER_MODEL (django.contrib.auth.models file or specific accounts.models)
@property
def is_odk_admin(self):
return self.groups.filter(name='odk-admin').exists()
- Add odk.urls to the main urls.py file:
urlpatterns = [
...
path('odk/', include('odk.urls'), name='odk'),
]
- Add menu or buttons to access Available form
# bootstrap5 menu item example
<li><a class="dropdown-item" href="{% url 'odk:xform_list' %}">{% trans "ODK available forms" %}</a></li>
- Add menu or buttons to access Submitted form
# bootstrap5 menu item example
<li><a class="dropdown-item" href="{% url 'odk:xformsubmit_list' %}">{% trans "ODK submitted forms" %}</a></li>
Connect to the Django admin site
- create a group 'odk-admin' with create, read, update access on odk objects
- Associate this group to the appropriate users
Available form: Build, Upload, Convert, Create
Connect to django-odk => Available form => Add and follow 4 steps:
-
Build an XLSForm file with 3 tabs 'survey', 'choices', 'settings' Cfr documentation. Do not forget to add 'today' & 'username' fields in Survey tab!
-
Upload xlsx file (XForm) by clicking on 'Choose file' and Save
-
Convert xlsx file to xml XForm compatible file Thanks pyxform!
From this point, you are ready to go with form encoding on your smartphone!
Follow ODK instructions to configure the connexion to the server
Get, fill-in and submit data using ODK Collect
- Create Model in odkdata to get submitted data in a model formatted like xlsx form. Thanks xlsconv!! Model creation is done into App
odkdata
with table name followed by_orig
suffix when converted by xlsconv.
Submitted form
Go to Submitted form menu of your server to see submitted data in XML format. On record view, click on Insert
button to insert submitted XML data into odkdata.models
created on step 4 hereabove.
Several record insert is available through admin interface. Select appropriate records (ie: those without insert date) and choose Insert in odkdata model
from action dropdown list and click on 'Send' button.
What next?
Create a new app in you project like odkdata2
with templates, views
(importing odkdata.models info) and urls
to manage display/map/export-xls/update/analyse submitted data from ODK-Collect!
Comments/Improvements welcome!
Investigate WQ Framework but I still don't see how to deploy offline forms on smartphone.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_odk-0.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79154aa6082b24fce145f559f91a40a31bb42b88e96297190be694c7e4150ef4 |
|
MD5 | c67ac30c666a1300a956d0deb348ec64 |
|
BLAKE2b-256 | 13bf81752223fabb36e43a7a8b75d34b3fd46cece39fc5d4fd4d5e19d539dcc6 |