2.12.1 • Published 10 months ago

ssas-enketo v2.12.1

Weekly downloads
-
License
GPL-3.0-or-later
Repository
-
Last release
10 months ago

SSAS Enketo

This module is built around enketo-core to facilitate offline and online data collection.

Features

  • Designed to work both in the browser and on mobile devices (Android and iOS).
  • Uses PouchDB to store sessions and attachments for offline support.
  • Session management. Support for multiple survey sessions.
  • Easily localizable. Has multi-language support.
  • Jump to screen to navigate around the survey.
  • Image optimization for large photos.

Development

nvm use 14
# Do not use npm, use yarn.
yarn install

Clone this repository and install dependencies (yarn is recommended). There are two types of tests in this project: integration tests (cypress) and unit tests (mocha). Make sure both tests are passing before releasing a new version. You have to download and install cypress on your machine and open the project folder in the app to run the tests. Plus, make sure you are running a http-server which serves the contents of www folder at http://127.0.0.1:8080/

How to Use

This module is used by simply loading the necessary html file in the Browser or in a WebView. Take a look at the configuration table and pass your parameters in your query string.

1) survey.html

This is where the survey is displayed. It will start with a loading screen until the survey is loaded (either from disk or from a URL). Then it will prompt the user to create a session or continue from a previous session. You need to pass in necessary configuration for this file to work properly.

NameRequiredDescription
langYesDetermines UI and Survey language. Pass in "en" if not sure.
surveyYesPath to your survey json file (previously transformed from xml using enketo-transformer)
modeYesOptions: online, offline (default). See survey modes section for further explanation.
baseNoThis will be prepended to all of the parameters taking paths (survey, submit, edit and return).
returnNoUpon submission, this url will be loaded.
bgNoSets the background photo to be shown while the survey is being loaded.
novalidateNoWhen this parameter is found, validation will be turned off for that session.
assetsNoAssets (images) will be loaded relative to this path.
smsNoIf exists, submissions can be sent via SMS to the number passed in.
jumptoNoSet this to "off" if you want to remove the search button in the toolbar
titleNoSet this to "off" if you want to hide the survey title
readonlyNoLoads the survey in read-only mode. Submit, save and validate buttons are hidden

Based on your mode, further parameters may apply.

1) A. Extra parameters for "online" mode

NameRequiredDescription
submitYesRequired with online mode. Should be the url to receiving OpenRosa server's submission endpoint.
authNoSets the authorization token for the current session. Only applicable in online mode.
editNoUse with online mode only. You need to pass the path to the json file for the submission.

1) B. Extra parameters for "offline" mode

NameRequiredDescription
sessionNoName of the session to create or continue. If you provide this, session modal will be skipped.
session_extraNoPass a json string to be served alongside with the session. Will be submitted to the server.
dbNoSets the name of the database used to store sessions. Defaults to "sessions" when not set.
instant_submitNoIf this parameter is set, the session can be submitted from the survey page, without going to submissions.

2) submissions.html

This page will display all the submissions stored offline and let the user upload them to the server either one by one or all of them at one go.

NameRequiredDescription
langYesDetermines UI and Survey language. Pass in "en" if not sure.
submitYesThe path for the OpenRosa server's submission endpoint
baseNoThis will be prepended to all of the parameters taking paths (server).
dbNoSets the name of the database used to store sessions. Defaults to "sessions" when not set.
authNoSets the authorization token for the current session. Always pass this if the server requires authentication.
bgNoSets the photo to be shown in the background while this screen is being displayed

Survey Modes

When displaying the questionnaire, you can choose from three survey modes

online

  • No locally stored sessions. When interrupted, all data may be lost.
  • At the end of the survey, the data is submitted to the server.
  • If there's no internet connection, survey may not be completed.

offline

  • Sessions are stored on the device.
  • Sessions will not be submitted to the server at the end of the survey.
  • Sessions must be sent to the server separately (via submissions.html)

Authorization

Some portal instances may have 'require authentication' turned on. In this case, it is not possible to download the survey or make a submission without a valid authorization token. There are two ways of passing in the authorization token into enketo.

  1. Pass via query parameter ?auth=...token...
  2. Pass via cookie enketo_token
2.11.0

10 months ago

2.12.0

10 months ago

2.10.0

10 months ago

2.12.1

10 months ago

2.7.0

1 year ago

2.6.0

1 year ago

2.9.0

11 months ago

2.8.1

1 year ago

2.5.4

1 year ago

2.8.0

1 year ago

2.5.3

1 year ago

2.8.3

1 year ago

2.8.2

1 year ago

2.8.5

1 year ago

2.8.4

1 year ago

2.8.6

12 months ago

2.5.2

5 years ago

2.5.1

5 years ago

2.5.0

5 years ago

2.4.1

5 years ago

2.4.0

5 years ago

2.3.0

6 years ago

2.2.0

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.10

6 years ago

2.0.9

6 years ago

2.0.8

6 years ago

2.0.7

6 years ago

2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago