Monthly Archives: April 2018

Hint: Changing the question after you have started collected data

The replace button on the form management page lets you replace one survey with another at any stage of the data collection process.  There are no restrictions on what you can change and this can cause some issues if you change a question type.

For example a customer had a question in their form “How far away from home is your work?”.  They originally specified this question as “decimal” and had collected data where it was recorded as 3.0, 4.5 etc.  However they later changed the type of the question to “text” and the submitted results contained values like “5 minutes”.  Unfortunately these results were not being applied to the database so they could not see the later results.

Cause of the Problem

Once you start submitting data for a form, a table is created to store that data.  The answers to different types of questions are stored differently:

  • integer question answers are stored as Integer
  • decimal are stored as double precision
  • text, select_one, select_multiple, barcode, image, video, audio are stored as text
  • geopoint are stored as geometries

So if you then change a text question to a select there is no problem but if you change it to an integer the data will not load.

Detecting the Problem

The monitor page will show the the errors and list the results that were not loaded.  To see these:

  1. Select the “Admin” Module
  2. Select “Monitoring”
  3. Set the source to “Submitted”
  4. Select “Show Instances”
  5. Select your project and survey if there are a lot of submissions from other surveys shown

The errors indicating a problem with the question type will look like:

ERROR: invalid input syntax for type double precision: “5minutes” Position: 127

So a bit cryptic but a problem with question type.  Its trying to write some text into a decimal question’s database column.

Fixing the Problem

Usually the problem can be fixed simply from the Analysis module.  Open a table view of your survey.  This will show the results that have been loaded.  Click on the icon “<” at top right to open the aside.

There are two useful buttons here: “Delete Data” and “Restore Data”.  However note the “warnings” section below before using them.

Case 1: You are still testing the form

If you are still testing the form select “Delete Data”.  As well as deleting the test data this will also delete the tables that store the data so next time you submit some results it will recreate these tables but using the latest question types.

Case 2: You have some valuable data loaded (or submitted)

In this case select “Restore Data”.  This will also delete the tables but it will then reload all of the data from the original submissions.

Warnings

Using “Restore Data” will

  1. delete any modifications you may have made to data after it was collected.  For example fixing spelling mistakes using the modify page.
  2. resend any notifications attached to your survey.  For example you may be sending an email with a PDF containing details on each uploaded record.  If you don’t want these emails to be resent then you can disable notifications while you do the restore.  However any records that had failed to load due to the question type change will then also not trigger the notification. So tricky.

Taking note of these warnings it is a good idea to change the data types of questions with care.

Tutorial 1 – Data Management

There are several ways to manage collected data and the best approach depends on the problem that you are trying to solve.

  1. Using the Modify page.  You may be an administrator and you want to fix errors in the data such as misspelt locations, other text used to answer a select question when a choice should have been selected and so on.  This is sometimes called “data cleaning” and it can be done quickly and easily in the modify page.
  2. Oversight forms.  You may want to add notes to a data record or update a field such as a priority and this may be done as part of an ongoing process.  In this case you can add an oversight form to the data collection form and if if it has questions with the same name as the data collection form then the answers to these questions can be changed.
  3. Tasks.  You may want to send somebody out to update a previously submitted form and you want them to change existing data and add new data. You can assign a task to do this.
  4. Webforms.  You may want to completely go over a single submission and change many answers.  In this case you can edit the data using a webform.
  5. Export / Import.  Alternatively if you want to completely revamp all your data in a spreadsheet you can export it and then re-import the updated spreadsheet.

This tutorial will just cover the first of these which is the “Modify Page” approach.

New Feature added 18th April 2018.  A checkbox has been added to the main screen which is labelled “Select data to change using a primary key”.  This allows you to select a specific record in submission to change.  Its use is covered in a new section after “updating other question types”.

Getting Started

Modify is part of Analysis so after you logon select the Modules menu, then Analysis and finally the Modify menu.

Updating Text

Basic Text Questions

In my sample form I collected some data that included a text question asking for the country.  On the modify page I selected this “Sample Form” survey and then the country question.

Each distinct answer is shown along with a count of how many times in the survey that answer was given.  So you can see in the above table that “Uganda” was entered 3 times.  “France” was entered only once however there is also an entry for a country called “Franc”.  I’m going to assume that’s a typo and so I click on the “Update” button to the right of that text value.

A dialog box is shown.  At the top is written the action that is going to be performed: “Modify Franc To”. Then there is a text box labelled “Reason”.   I have entered “Spelling Mistake” in here.  This reason will be shown in the audit trail of changes.  Next there is a select box called “Existing Choice” which is disabled because there are no select choices associated with this question. Next is a select box called “Existing Text”.  This allows you to select any of the other answers that have been submitted for this question.  In this case I selected the answer “France”.  Finally there is another text field where you could have entered any new value for the text that you wished.

After you press the Save button you will see the updated results.

Now France is entered twice.  Exported results and graphs will use this updated data.

Replacing an “other” text question with a select choice

This time I selected the question “transport_other”

You can see there are 3 distinct values.  The first one is blank and it occured 4 times.  This is the number of times that the “other” text question was not relevant because a choice was selected and hence no answer was entered.  The values of “Scooter” and “Truck” were each entered once.  I am going to replace the answer “Scooter” with one of the choices in the select question and so I click on the “Update” button next to the “Scooter” text.

For the reason I have entered “Categorise Scooter as Motorbike”.  The “Existing Choice” select box is now enabled and I selected one of the choices from the select question which was “Motorbike”.  The system knows that the select question is related to the other question because there is a relevance on the other question that references the select question.  Rather than selecting an existing choice I could also have just changed the text in other to say “Moped”.

After clicking Save you will see that “Scooter” has gone and there are now 4 blank answers for other.

However if you export the data you will see that the transport select question now has an additional response for “Motorbike”.

Adding new select choices to replace other text

This is done exactly the same way as replacing text with an existing choice.  However you first need to add your additional choice to the select question, either using the online editor, or in XLSForm and then replace the existing form with the updated one.  You will then be able to select the new choice.

Updating Other Question Types

The previous sections covered updating text answers using only the existing answers to choose what will be updated.   This is great for changing all occurrences of a misspelt name however sometimes only some values need to be updated.  For example if you need to fix a wrongly entered age for a person then you don’t want to change all occurrences of that age.

Modify allows you to update text, select one, integer and decimal answers that have a specific value and also a text question with a specific value.  Note this might not always be discriminatory enough to get just the record you want to update in which case you will need to use a different method such as Webforms or an Oversight form.

I’m going to change an “age” question.  First I select the name question.  This has to be a text question. Then I check the checkbox “Update a different question” and then I selected the “age” question.

You can see in the results that there were 2 people called Richard one of whom has an age of 34 and the other 55.  I’m going to change the age of 55 to 57 by overtyping it and then pressing the update button at the bottom of the list of data.  That is all there is to it.

Updating Other Question Types For a Single Record

You may want to just change a value that is in error on a specific submission.  You can now do this by selecting the checkbox “Select data to change using a primary key”.

You will see that the drop down fields for selecting language and question will be replaced by a drop down to select the Form.  The checkbox “Update a different question” will also be automatically selected and disabled so you cannot change it.  In other words you are not allowed to change the primary key value only the value of another question.

You will also see the the “Text” value for each record on the left hand side of the form is a number which will correspond to the unique key of the record that you want to replace.

For the top level form discovering the primary key for the record that you want to change is easy.  This key is included in all exports of data.  If you want to update a specific value in a subform then you will need to use the table view in the analysis dashboard to find the unique key in the subform.

Reviewing and Reversing Changes

All changes to the data are audited and can be reversed.  To see the audit log select the “Review” Menu.

Above you can see the audit trail for the sample form where I recategorised scooter as a motorbike and changed the name of the country to France.  Each change includes the reason, a description of what happened which is created by the system and the name of the person who made the change.  If you click on the details button it will give more information about the change including listing the primary keys of all the records that were changed.  To reverse the change you simply click on the reverse button and the change will be undone.

There is a caveat here, you can reverse changes in any order however if one change depended on another and you don’t reverse them from last change to first then you may be left with some altered data in the system. If that were to happen then an error should be shown and you can fix the problem some other way.

Accountability Product

Announcing another “Product” from Smap.  These products consist  of form templates for and instructions on how to set them up on a Smap server to address a specific objective.  Or at least start to address that objective as you will want to customise the forms to suit your needs.

Overview

The accountability product includes 2 forms the first of which is a feedback form that can be completed on a mobile phone or in a web browser. The second is an oversight form that is attached to the feedback form and that can then be used to record actions taken in response to the feedback.

Feedback Form

The feedback form is just a standard form that can be completed in the fieldTask application on a phone or tablet as well as in web-forms in a browser. If you were taking feedback in a call centre then you would presumably use web-forms. Alternatively if you were in a remote location without data connectivity then you would probably use fieldTask.

Oversight Form

The oversight form has the following data entry fields:

  1. Responsible person. A text field to enter who is responsible for processing the feedback.
  2. This has the same name as the priority question in the feedback form and hence it shows the same value. The priority can however be changed from the value initially set in the feedback form.
  3. Translation of Feedback. This is a text question that is linked to the feedback description set in the feedback form.
  4. Transcription of the issue statement. The manager can play the audio statement and type the text into the text field.
  5. Image labels. The labels shown were generated automatically by Amazon Rekognition. However they can then be manually modified by the user.
  6. Date of any action taken

Getting Started

You can download a zip file containing this product and a PDF with instructions from the Smap Products web page.

 

Version 18.04

Improved Performance

Refreshing fieldTask will now be faster.  Note This requires fieldTask 5.33.  The changes are:

  1. If you change an image or other media file that is used in a question or choice then that new media file will be downloaded automatically to the mobile device using push notifications.
  2. A media file, including a CSV file, will now only be downloaded to a phone if it has changed.
  3. Media and CSV files are only downloaded once if they are used by more than one form on the device.  In other words as long as the media file is coming from “Shared Resources” it is also shared between forms on the device.
  4. If the media changes but the form has not changed then the form is not re-downloaded only the changed media files are.

You can expect substantial reductions in download time under the following circumstances:

  • You have a form that uses many images in questions and choices but you are making changes to that form by adding new questions or changing the question text.  Now after each form change only the new form will be downloaded and not all the images.
  • You have a csv file that is constantly being changed.  Now only the changed csv file will be downloaded and not the form and any other csv files or media.

However performance may be slightly worse if you have many forms that use media and only one is updated.  The reason being that during refresh the manifest will now be checked for all the forms that use media to see if the media file has been changed.  Previously the change in a media file would not have been picked up and the form would not have been updated on the device.  This is a quick operation and will only be noticed if the number of forms is quite large.

Other Features

Filtering on table view in dashboard

You can now use “advanced filtering” in these table views.  For example adding a filter such as

${district} = ‘capital’ and ${gender} = ‘female’

The number of records that match the filter as well as the total number of records will be shown just above the table of data.

Issues Fixed

  • Issue 63.  Labels are not shown in PDF exports if the label is for a select question that uses an external CSV file to get its choices
  • Issue 153.  When you download data and upload again in Analysis there is a warning message about “question name missing”
  • Issue. The Legacy XLS export does not allow select multiples to be split into separate columns.
  • Issue.  Replacing a survey that used uncompressed select multiples results in the select multiple questions being converted to compressed but the old data is not converted making it invisible.