Upload
Use the Uploader to turn properly formatted XLS files into XForms for use with Open Data Kit. See the documentation tab to learn how to fill out the XLS template.
Privacy Policy
With the user's permission, the information uploaded through this tool will only be used to improve the system.
Technical Support
Join our Google Group for clarification on how to use this service.
Source Code
Want to contribute to this tool? View this project on GitHub.
XLS Template
This XLS template demonstrates some of the features currently supported by XLS2XForm.
Introduction
License: BSD
xls2xform is a Python script designed to make writing surveys for
Open Data Kit a snap. To start, check out some files in example_xls
to get an idea of the survey language accepted by the script.
To use the script run the following command:
python xls2xform.py file.xls
This creates an xform for each worksheet in surveys.xls (excluding the
sheet named "Select Choices", which describes multiple choice
options).
How to use xls2xform with Open Data Kit
I need to get surveys up and running on the phones.
- Design survey. What questions does this survey intend to answer?
What survey data is needed to answer these questions?
- Write survey in Excel survey language described on
http://xform.childcount.com
- Convert the Excel file into XForms for Open Data Kit on
http://xform.childcount.com
- Log in to an ODK Aggregate server
and upload your XForms. There are two options if you receive an
"Error: Form Already Exists for this Namespace/Id attribute". You
can delete the form that already exists on the server and try
uploading your form again (deleting the form deletes all data that
has been collected for this form). Or you can give your form a new
name, change the name of the corresponding excel worksheet and go
back to step 3.
- Download the XForms to the phone from http://childcount.appspot.com
- Enter data on the phone
Document all features
- I need to do this in
xls2xform.py
- XML tag
- max length of multiple choice value, tag?
Technical Notes
Embedding this app in a django project
urls.py:
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^', include('project-name.xls2xform.urls')),
)
In the Production App, urls.py is not used to serve static
content. All static directives set in urls.py need to be transferred
over to the Apache configuration file in order to work with mod_wsgi.
Shortcut for working with the Android emulator
Thanks to Mårten Österberg.
#!/bin/bash
# copy all forms in this folder over to emulator and start emulator
sudo mount -o loop ~/.android/avd/my_avd.avd/sdcard.img /media/sdcard
sudo cp *.xml /media/sdcard/odk/forms/
sudo umount /media/sdcard/
~/android-sdk-linux_86/tools/emulator -avd my_avd &
API
NAME
xls2xformwrap.xls2xform.xls2xform
FILE
/usr/local/wsgi/xls2xformwrap/xls2xform/xls2xform.py
DESCRIPTION
A Python script to convert properly formatted excel files into
XForms for use with Open Data Kit.
CLASSES
exceptions.Exception(exceptions.BaseException)
ConversionError
class ConversionError(exceptions.Exception)
| Method resolution order:
| ConversionError
| exceptions.Exception
| exceptions.BaseException
| __builtin__.object
|
| Methods defined here:
|
| __init__(self, type, info)
|
| __str__(self)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from exceptions.Exception:
|
| __new__ = <built-in method __new__ of type object at 0x7f892f7bf8a0>
| T.__new__(S, ...) -> a new object with type S, a subtype of T
|
| ----------------------------------------------------------------------
| Methods inherited from exceptions.BaseException:
|
| __delattr__(...)
| x.__delattr__('name') <==> del x.name
|
| __getattribute__(...)
| x.__getattribute__('name') <==> x.name
|
| __getitem__(...)
| x.__getitem__(y) <==> x[y]
|
| __getslice__(...)
| x.__getslice__(i, j) <==> x[i:j]
|
| Use of negative indices is not supported.
|
| __reduce__(...)
|
| __repr__(...)
| x.__repr__() <==> repr(x)
|
| __setattr__(...)
| x.__setattr__('name', value) <==> x.name = value
|
| __setstate__(...)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from exceptions.BaseException:
|
| __dict__
|
| args
|
| message
| exception message
FUNCTIONS
add_label(xml_str, node)
Add a label to node's list of children, the XML contained in
that label comes from xml_str.
We want to make referencing variables easier, maybe using
$varname.
construct_choice_lists(sheet)
Return a dictionary of multiple choice lists from the Excel
Worksheet 'sheet'.
The Worksheet named 'Select Choices' defines the choices for
all multiple choice questions. This sheet must have three
columns with the following headers: 'list name', 'value', and
'label'. Each row below the columns headers describes a single
choice option, the value in the 'list name' column is the name
of the list of multiple choice options that this option
belongs to. The 'value' column specifies the value that will
be stored in the database when this option is chosen, and the
'label' column is what the surveyor will see on the phone's
screen.
write_xforms(xls_file_path)
Convert a properly formatted excel file into XForms for use with
Open Data Kit. Return a list of all the XForms created.
begin_command ::= begin (survey|group|repeat)
end_command ::= end (survey|group|repeat)
q_command ::= q (string|int|geopoint|decimal|date|picture|note|select_choices)
select_choices ::= (select|select1) list_name
We do not support multiple languages yet, but we will.
xpath(a, b)
Return the XPath from node a to node b, assumes b is a descendant
of a.
DATA
tag_char = r'[a-zA-Z:_0-9\-\.]'
tag_start_char = '[a-zA-Z:_]'
xform_tag_regexp = r'^[a-zA-Z:_][a-zA-Z:_0-9\-\.]*$'