christopherKwiatkowski / survey_builder

Home Page:http://wiki.chip.org/indivo/index.php/Survey_Builder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Indivo Survey Builder

About

Getting Started

Download

  1. git clone git://github.com/chb/survey_builder.git
  2. cd survey_builder
  3. git submodule init
  4. git submodule update

Quick Look

The quickest way to run the builder (without preview functionality) is to open up survey_builder/surveybuilder/index.html in your favorite browser. (though Chrome's XMLHttpRequest by default doesn't let you read from the file system anymore, so you can launch it with the flag --allow-file-access-from-files, or use a different browser)

####Enabling Previews

The builder's example data connector is configured by default to read and save to your browser's local storage when retrieving and storing definitions. This setup works well when testing the builder in conjunction with the Indivo Survey Client, which by default is configured to read from browser local storage.

In order to view previews of your survey, you will need to install the Indivo Survey Client and then configure the builder's PREVIEW_PATH variable in survey_builder/surveybuilder/index.html to point to where the client is hosted.

Note, since you can't access local storage cross-domain, you will need to host both the builder and client under the same domain (using Apache HTTP Server on your localhost for example) if you want them to use the default local storage setup for saving and loading.

Data Connector

The Indivo Survey Builder saves and retrieves survey definitions using a generic data connector that provides two methods

  • save_survey
  • passed the RDF/XML definition to save
  • get_survey
  • retrieves an RDF/XML definition to load

The data connector resides in survey_builder/surveybuilder/index.html, and replacing the example implementations with ones that communicate with another service is your key to integrating the builder with a persistent store.

###Development v.s. Production Modes By default, the builder will run in development mode, allowing for console logging and easier debugging. To compress the builder for increased performance and a decreased download profile, do the following

  1. from survey_builder/ run ./steal/js ./surveybuilder/scripts/build.js
  2. edit survey_builder/surveybuilder/index.html and change the existing script tag to point to the new production bundle:
  • old steal('surveybuilder').then(function($) {
  • new steal('surveybuilder/production.js').then(function($) {