npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ssas-enketo

v2.12.1

Published

ssas enketo module

Downloads

12

Readme

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.

| Name | Required | Description | | ---------- | -------- | ----------------------------------------------------------------------------------------------- | | lang | Yes | Determines UI and Survey language. Pass in "en" if not sure. | | survey | Yes | Path to your survey json file (previously transformed from xml using enketo-transformer) | | mode | Yes | Options: online, offline (default). See survey modes section for further explanation. | | base | No | This will be prepended to all of the parameters taking paths (survey, submit, edit and return). | | return | No | Upon submission, this url will be loaded. | | bg | No | Sets the background photo to be shown while the survey is being loaded. | | novalidate | No | When this parameter is found, validation will be turned off for that session. | | assets | No | Assets (images) will be loaded relative to this path. | | sms | No | If exists, submissions can be sent via SMS to the number passed in. | | jumpto | No | Set this to "off" if you want to remove the search button in the toolbar | | title | No | Set this to "off" if you want to hide the survey title | | readonly | No | Loads 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

| Name | Required | Description | | ------ | -------- | ------------------------------------------------------------------------------------------------ | | submit | Yes | Required with online mode. Should be the url to receiving OpenRosa server's submission endpoint. | | auth | No | Sets the authorization token for the current session. Only applicable in online mode. | | edit | No | Use with online mode only. You need to pass the path to the json file for the submission. |

1) B. Extra parameters for "offline" mode

| Name | Required | Description | | -------------- | -------- | ---------------------------------------------------------------------------------------------------------- | | session | No | Name of the session to create or continue. If you provide this, session modal will be skipped. | | session_extra | No | Pass a json string to be served alongside with the session. Will be submitted to the server. | | db | No | Sets the name of the database used to store sessions. Defaults to "sessions" when not set. | | instant_submit | No | If 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.

| Name | Required | Description | | ------ | -------- | ------------------------------------------------------------------------------------------------------------- | | lang | Yes | Determines UI and Survey language. Pass in "en" if not sure. | | submit | Yes | The path for the OpenRosa server's submission endpoint | | base | No | This will be prepended to all of the parameters taking paths (server). | | db | No | Sets the name of the database used to store sessions. Defaults to "sessions" when not set. | | auth | No | Sets the authorization token for the current session. Always pass this if the server requires authentication. | | bg | No | Sets 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