Getting Started with Mobile Data Collection using ODK
More and more organizations 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 visualize 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 codesite 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.
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 to 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, XLSforms, and 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, etc.) 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 into 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 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 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 the filesize is smaller when you want to send your completed data over the internet.
- Use the "Choose One" question type if you'd like the user to select one option from several options. You can specify which options you present by clicking "Add Option." Make sure 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, make 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 the xml of your form. 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 localizing your form, you must enter English text here as well as localized 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 localizing forms.
Default value: this is the default information that will be presented to the user. For example, if you are gathering information on a group of children and you know the majority of the childrens' age is 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, check 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 like 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 unzip 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 License 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 in this stage. You can re-run the Setup Wizard by going back to the folder where you installed ODK Aggregate and double-click the installer to run it again.
- Congratulations! When the script is finished running, ODK Aggregate is now installed on your AppEngine instance. When it's 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 get in.
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 use your own instance to upload your custom forms to).
- Login 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.
- See all tutorials.