The basic concepts behind Syrup and it’s parts are as follows:

  • The Syrup library creates a single entry in the browsers window namespace as syrup.

  • TaffyDB query objects or qObj

    In order to provide both a simple and powerful query facility to the full survey data Syrup makes use of TaffyDB to create query objects at various levels within the main data: questions, baskets and productViews are currently provided.

    Everywhere you see a qObj you can apply both TaffyDB functions as well as those custom functions provided by Syrup such as baskets().

To look at the contents of any qObj simply use the get() method as in qObj.get() which will return an array of data objects represented by the specific qObj which could be baskets, questions,the whole data set and so on.

  • With the exception of few stand alone helper functions the entire library uses chaining syntax (think jQuery). For example, to get the basket contents from a qObj we simple do qObj.baskets() which returns another qObj containing just basket data from the questions detailed in the source qObj

    Like so
    basket = r.questions().qTitle("Control").baskets()
  • RespondentData

    RespondentData is a class on the syrup object and provides the entry point for fetching data from the main ConceptSauce data API.

    Once data is loaded you are returned an instance of RespondentData (usually assigned to the variable r) which is then used to access and query qObjs on the data.

  • questions()

    questions() returns a qObj of available questions data relative to the preceding qObj. The qObj is augmented with data from other levels of the original set.

  • productViews()

    productViews() returns a qObj centered around the productViewEvents section of the survey data. productViews has extra fields to aid working with the data. These fields come from other levels of the original data set.

  • baskets()

    baskets() returns a qObj for the basketContents section of data. As with other custom functions in Syrup, baskets adds extra data points to aid use in queries.

  • Filters

    Syrup contains a growing number of filters to refine the content of a qObj. Where possible these filters are designed so they can be fed data from any level of the original data set (questions or baskets for example) and will attempt to produce relavent results.

  • Helper functions

    A growing number of general helper functions exist. For example timings() which will return a plain Array of Objects with all relevant timings from whatever source qObj was supplied, some fields maybe blank depending on the source qObj data.

    Timings Example
      let result = someQobj.timings()
      // result is an `Array` of `Objects` with the following fields:
      // startTime
      // endTime
      // duration
      // questionID
      // questionTitle
      // type