1.0.13 • Published 8 years ago

react-surveys v1.0.13

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
8 years ago

Survey model reference

A survey has common properties and can contain an arbitrary number of answer fields.

This document aims to define a JSON format for storage of survey definitions, which will be returned by the survey API and stored in a MongoDB database.

Survey fields

Fields that are common to every survey and providing basic information.

Field nameDescription
idSurvey ID
nameSurvey name
descriptionSurvey description (optional)
authorSurvey's author
questionsArray of question object

question object

A question has a randomly generated identifier, type, name and an optional description. Questions can be mandatory or optional.

Question format defines how the user should answer the question. It can be a freeform input of text or choice types like radio buttons, checkboxes and selects.

For choices input, a list of valid options is attached to the question, each option having a unique identifier and name.

Field nameDescription
idQuestion unique ID
nameQuestion name
descriptionQuestion description (optional)
requiredShould the answer be required. true or false
typetext / paragraph / radio / checkbox / select
optionsIf question is of type radio, checkbox or select, array of option object

option object

If the question is of type radio, checkbox or select, valid options must be attached to it.

Field nameDescription
idOption unique ID
nameOption name

Example survey JSON

{
  "id": "hJVYUldjnf",
  "name": "Music blind test",
  "description": "A sample survey for react-surveys",
  "author": "Hugo Caille <hugo.caille@isen-lille.fr>",
  "questions": [
    {
      "id": 1,
      "name": "Stop the world cause i wanna get off with you",
      "required": false,
      "type": "text"
    },
    {
      "id": 2,
      "name": "Interstate 8",
      "description": "Find the band singing this",
      "required": true,
      "type": "select",
      "options": [
        {
          "id": 1,
          "name": "Moderat"
        },
        {
          "id": 2,
          "name": "Modest Mouse"
        },
        {
          "id": 3,
          "name": "Parquet Courts"
        }
      ]
    },
    {
      "id": 3,
      "name": "How you'll rate Tame Impala's Lonerism",
      "type": "radio",
      "options": [
        {
          "id": 1,
          "name": "1"
        },
        {
          "id": 2,
          "name": "2"
        },
        {
          "id": 3,
          "name": "3"
        },
        {
          "id": 4,
          "name": "4"
        },
        {
          "id": 5,
          "name": "5"
        },
      ]
    }
  ]
}
1.0.13

8 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago