CAPI demonstration

A demonstration program using CAPI to conduct proxy-means test assessments

Introduction

The program implements a CAPI (Computer-Assisted Personal Interview) version of the PMT assessment questionaire which has been used in Mongolia over the last few years.  It can be run in a web browser on a desktop, laptop or tablet/phone.

***  The web version of the application is found at https://www.nac461.uk/MonPMTApp/   ***

The program can be installed on an Android tablet using an APK file.

Download APK file

(http://blog.droidapks.net/how-to-install-apk-on-android/ explains how to install APK files on an Android device.)

The following web browsers have been tested successfully.

  • Google Chrome (version 47 on Windows 8 and 10, Android and iOS)
  • Apple Safari (version 5.1.7 on Windows and the latest version on iOS).
  • Opera (version 35 on Windows 8)
  • Firefox (version 44 on Windows 8 and 10)
  • MS Edge (on Windows 10)

Please note: the application DOES NOT run on Internet Explorer version 11.  I have not been able to determine why this is the case, but given that a wide range of other browsers are freely available, this should not present a problem.  Curiously, it does run using MS Edge on Windows 10.

The forms have been optimised for a 1280 x 800 screen.  This is typical of many 7 to 8 inch tablets.

Using the program

When the application starts, enter a name (as an interviewer) and a 5 digit ID (any value is acceptible).  These will be stored for future use.
To begin an assessment interview, enter the name of the respondent and click/touch the “New Assessment” button.  Hopefully, the application is relatively intuitive and easy to use and so no further instructions are provided here.  I would be interested in feedback.

One of the potential issues with web-based applications is that locally stored data can be removed when certain ‘cleaning’ programs are run.  This could result in the loss of PMT assessment data that has not been uploaded to a central server.  To address this problem, the software includes a mechanism to store periodically the entire local database as a downloaded file.  This file is encrypted and is only readable by the PMT application.  The backup file is created whenever the interview status is changed, which would normally be at the end of the assessment.  The ‘Admin’ screen has instructions on how to restore the database in the event of accidental data loss.  Because of the security limitations of web-based applications, the program cannot remove these backups.  They have to be deleted manually.

Features

The application implements the 2016 version of the Mongolian Proxy Means Test questionnaire.  Some of questions found on the front page of the paper questionnaire are not included but all of the data required for the score calculation are present.  The example is adequate for demonstrating the use of this type of technology.  It includes:

  • Offline capability – if the tablet or computer is not connected to the internet it will still work.  This is a key feature.
  • Use of simple look-up tables which allow the developer to modfiy the question responses without reprogramming.
  • Capture of signatures – this is best done with a stylus of some kind but it can be done using a finger on a touch screen.
  • A validation system using simple, logical expressions to identify erroneous or spurious data in the assessment.  A number of example error checks have been included.  More can be added.
  • GPS readings – if the device is equipped with a GPS receiver then the location can be recorded and stored with the assessment.
  • A mechanism for sending the data to a central, online database such as MySQL.  This uses a JavaScript/PHP combination. The data can also be exported as a JSON file.
  • Multiple language support – the ability to switch language (from English to Mongolian) is already present.  The reference tables for code:label combinations include provision for two languages but more could be added.
  • A facility for storing text entries when the code for ‘other’ has been selected.  A ‘pop-up’ form is displayed so that the user can enter the text.

Technology used

One of the reasons for developing this application was to teach my self some new programming techniques.  Although there are a number of very good CAPI systems available free of charge (e.g Survey Solutions and CSPro), I decided to use a development environment that can be used to create any type of app.  The criteria I used were:

  • Reasonable cost for the development software
  • No additional cost for deployment (runtime/use licence)
  • Portable across a wide range of platforms (specifically able to run on Android tablets, iPads and web browsers on laptops and desktops)
  • A very simple and intuitive interface for the user.

The best solution that I found for this was NSB/AppStudio (http://www.nsbasic.com).  The FAQ (http://wiki.nsbasic.com/NSB/App_Studio_FAQ#What_kind_of_dev_tool_is_this.3F) provides a very good summary of what NSB/AppStudio is and what it can do.

The application uses a combination of JavaScript, HTML5 and CSS.  Although the language is based on Visual Basic (in order to attract programmers with a knowledge of this language), it is converted into JavaScript when the project is deployed.  The programmer has the option of working in JavaScript directly.  This is what I chose to do as JavaScript offers much more as a language.  The jQuery mobile framework (https://jquerymobile.com/) is integrated into NSBasic and is used to provide a consistent interface across platforms.  Bootstrap and others are also available.  Internally, the application uses the alasql (http://alasql.org) library for data storage and manipulation.  Reference data (lookup codes, area names and codes etc.) are distributed as JSON files with the UTF-8 character set.  These are loaded into SQL (alasql) tables when the application is run.  The PMT assessment data are also stored in alasql tables.  For persistence, they are written to local storage as the application is used.  There is a further option to ‘download’ the current PMT data to the device.  Initially, I considered using WebSQL, which is SQLite, but this is now a deprecated feature and is no longer available in some browsers. Alasql is an implementation of SQL in native JavaScript and is therefore relatively future-proof as all browsers include Javascript.

For obvious reasons the application has been designed for offline usage.  It has to be completely self-contained and not dependent on a live internet connection.  In the web version this is achieved by the use of the Application Cache (AppCache).  All of the components of the webpage are stored on the local computer and, if it is offline, they are loaded from this local source.  Native apps for Android, iOS and Windows can be created by using PhoneGap.  Deployment using this method is built into the IDE.