Getting Started with Mobile Data Collection using ODK
More and more organisations are using mobile devices to collect data in the field. Open Data Kit (ODK) is a suite of tools that allows data collection using Android mobile devices and data submission to an online server, even without an Internet connection or mobile carrier service at the time of data collection. Streamline the data collection process with ODK Collect by replacing traditional paper forms with electronic forms that allow text, numeric data, GPS, photo, video, barcodes and audio uploads to an online server. You can host your data online using Google's powerful hosting platform, AppEngine, manage your data using ODK Aggregate and visualise your data as a map using Google Fusion Tables and Google Earth.
Created by developers at the University of Washington's Computer Science and Engineering department and members of Change, Open Data Kit is an open-source project available to all. Please visit their ODK project page on Google's code site for more information for developers, recent updates, more tutorials, and to contribute to the project.
This image shows data collected remotely using Open Data Kit and displayed in Fusion Tables.
Let's Get Started!
1. Search for the "ODK Collect" app from Google Play on your mobile device, or from Google Play in your browser. Install the latest version on your mobile device. For more information about ODK Collect and its requirements, visit the ODK Project Page.
2. Download the Sample form to use
during this tutorial.
There are several ways you can create forms for ODK. You can use ODK Build, XLSformsor by creating XML forms. If you're creating a form for the first time, ODK Build may be the simplest way to start, and this tutorial will cover using ODK Build. For creating more complex forms, take a look at the documentation provided on XLSforms' Formhub University.
- Go to ODK Build at http://build.opendatakit.org
- Create a new account or log in with an existing account. Note that this account is different from your Google Account, and you can choose to use a different login and password. Your forms will be saved to this account for future reference.
- Add questions to your form by clicking on the type of question you'd like to add
(eg. location, text) at the bottom of the page.
Each question has several common properties as well as unique properties. For an explanation of the Common Properties, see below. You do not need to save each question as you go, but remember to save the form when you're satisfied with it.
- Enter a Text question, such as "What is your name?", in the Caption Text
Fill in the properties of the text field question on the right-hand side. Optional: you can enter a minimum and/or maximum character length for the text field.
- Enter a Numeric field to allow users to record a number in their form, such as
"What is your age?" in the Caption Text section.
In the properties section, specify whether you'd like to record the number as an Integer (whole number) or Decimal (0.0).
- Allow the form users to specify a Date. The phone will automatically record the current date, and allow the user to enter the date or modify the date in your form.
- If the users of your form have a mobile device that is equipped with a GPS chipset, you can add a Location entry to your form. The question will prompt the user to record the GPS location. The user will be able to view an estimate of the phone's built-in GPS accuracy while the phone's GPS acquires satellite positions.
- Allow users of your form to attach media files to their form submissions. You can select from Image, Audio or Video as the media format. The form will switch to the device's camera mode, voice memo mode or video camera mode, and the media will be stored with that form entry. For this example, enter "Take a photo" in the Caption Text section and select "Image" as the Kind of media that you will use from the drop-down menu. Hint: if you know you're going to have a slow Internet connection when you want to upload your form submissions, and you wish to have photos inside your forms, some devices allow you to reduce the default image size so that the filesize is smaller for sending your completed data over the Internet.
- Use the "Choose One" question type if you'd like the user to select one option from several. You can specify which options you present by clicking "Add Option". Make sure that you add an underlying value to your Options; this is required for each Option. Use lower case text and underscores ( _ ) instead of spaces.
- Use the "Choose Multiple" question type for multiple choice questions. As with
Choose One, be sure to add an underlying value to each Option and use lower case and
underscores for the underlying value fields.
Common Properties in Form Questions
Data name (required): This is the variable name that is stored in your form's xml. You must use lower case and underscores ( _ ) instead of spaces.
Caption Text (required): Enter your question as you'd like it presented to the user.
Hint: Specify a question's hint or help text. Note: If you are localising your form, you must enter English text here as well as localised text. If you do not want to enter English default text, you must create the forms as XML in a text editor. See the tip at the end of this tutorial for more information about localising forms.
Default value: This is the default information that will be presented to the user. For example, if you are gathering information about a group of children and you know that the majority of the children are aged 12, you can enter "12" as a default value.
Read-only: If you don't want the user to be able to enter information for this question, tick this box.
Required: Users will not be able to save a form as completed unless they have entered information for questions that are checked "required."
- Once you're satisfied with your form, save it to your ODK Build account. Go to File > Save Form As. Next time you log in to your account, you can select File > Open to open the form.
- To download the form to your computer, select File > Export as XML. You will see
xml code. Click the "Download" button to save the file to your computer as an .xml
file. This is the format that you will import onto your mobile device in the next
Tip: One of the advantages of ODK is that you can create localized forms. The functionality to create localized forms in ODK Build doesn't exist yet, but you can look at these sample forms (and the Widgets form in particular) as guides to creating your own XML forms that are localized.
Branching questions where the second follow-up question is dependent upon the answer to the first question, must also be written in XML. Note that displaying data from branching questions is more difficult in Fusion Tables and Google Earth.
If you'd like to learn more about creating your own forms using XML, view the javarosa xforms training guide.
For this tutorial, you will set up your own server using AppEngine infrastructure and ODK Aggregate. ODK Aggregate allows you to set up a ready-to-deploy server where you can upload your form submissions, export them as .csv files and send them on to other services such as Fusion Tables.
- First, you'll need to set up a Google AppEngine account. If this is your first time using AppEngine, Google will send you a text message to confirm your identity, so have a text-enabled phone ready. Note: A given mobile number can only be used once for creating an AppEngine instance.
- Once you've confirmed your mobile number and logged in, click "Create an
- Give your application an "Application Identifier." This will become part of the URL
for your AppEngine instance, e.g. "myurl.appspot.com."
(If you would like to restrict the permissions for who can access your data, read the Security section below. You can edit the Security settings in this step.)
For this tutorial, we will use the default "Open to all Google Account Users." Once you've entered an identifier, you will receive confirmation that your application has registered successfully.
- Download the latest version of ODK Aggregate from the ODK Downloads page.
- Unzip it (single click the file in your Downloads folder on a Mac or right click and unzip it on a PC). The file will be unzipped as a folder called "ODKAggregate-version-OS-installer".
- Double click to run the application. You will enter the ODK Aggregate Setup Wizard. Click "Next".
- You will be prompted to agree to ODK Aggregate's Licence Agreement. Then, select the location on your computer where you want the installer files to store the software that will run on Google AppEngine.
- Run the Setup Wizard. Enter the ODK instance name (e.g. "odktutorial" for odktutorial.appspot.com) and the Google account associated with that instance.
- Once the Setup Wizard finishes configuring ODK Aggregate, you'll be prompted to run the installation script.
- You'll be prompted to enter the Google Account and password associated with the AppEngine instance again.
- Wait 3-10 minutes for the script to run. Once it's finished, you'll get a "Success" message. If you made a mistake entering the information in the Setup Wizard, you'll find out during this stage. You can rerun the Setup Wizard by going back to the folder where you installed ODK Aggregate and double clicking the installer to run it again.
- Congratulations! When the script has finished running, ODK Aggregate has been installed on your AppEngine instance. When it has finished running, confirm that it's set up correctly by visiting your AppEngine URL (e.g. myurl.appspot.com). You can sign in with your Google Account or click "Anonymous Access" to enter.
Restricting Permissions to ODK Aggregate for Increased Security
Since ODK Aggregate 1.0.n was released, users now have options for setting access
permissions to their ODK Aggregate instances through the Site Admin interface. Now, you
can decide who has access to submit data collected in the field, who can view the
submitted data, who can edit data and publish externally. We will cover this in more
detail in the next tutorial called "Manage
your Data with ODK Aggregate." Alternately, you can set restrictions via your
AppEngine instance, but it's more difficult than using ODK Aggregate to set access
permissions. Learn more about authentication
Now that you've set up your AppEngine instance with ODK Aggregate, you can upload your forms - the last step before you start collecting data out in the field with your forms! We'll walk through the three main tabs of the ODK Aggregate interface: Submissions, Form Management and Site Admin in the next tutorial called "Manage your Data with ODK Aggregate". You can upload XML you downloaded from ODK Build. ODK Build also lets you send forms directly to your ODK Aggregate instance, without having to download the actual XML file.
- Go to your AppEngine instance (or view the sample one we created at http://odk-tutorial.appspot.com, but upload your custom forms to your own instance).
- Log in with your Google Account if prompted.
- Click on the "Form Management" tab.
- Choose the form that you wish to upload to your instance and hit "Upload". If you have media files that are part of your forms, for example for images inside questions, you can also upload them here.
- If your form has uploaded successfully, you can close out the Upload Forms window.
You will now see your forms in the "Form Management" tab, ready to accept
Discussion & Feedback
Have questions about this tutorial? Want to give us some feedback? Visit the Google Earth Outreach Discussion Group to discuss it with others.