Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Developer documentation

Henri Cattoire edited this page Apr 15, 2022 · 11 revisions

Tally integration

To integrate with Tally (a platform to build and share forms), our application provides a custom class (TallyForm). This class is able to validate forms and transform them to a more suitable object from which other (model) objects can be created (as demonstrated in the tallyregistration endpoint).

To validate and transform a Tally form, a JSON file with rules about the structure of the form is used. We call this the questions file.

Structure of questions file

root
|
|- index
|  |- question
|     |- attributes
|- index
|  |- question
|     |- attributes
|- ...

The questions file consists of multiple indexed question objects (each with their own unique attributes). TallyForm compares these objects against the questions in the Tally form and transforms them where necessary.

{
  "0": {
    "question": [
      "Are there any responsibilities you might have which could hinder you during the day?"
    ],
    "field": "hinder_work",
    "type": "TEXTAREA",
    "required": false
  },
  "0": {
    "question": [
      "Birth name"
    ],
    "field": "first_name",
    "type": "INPUT_TEXT",
    "required": true
  }
}

Example of a questions file with two questions.

Question object

A question object can have different attributes. Some attributes are required and others are optional.

question

Type: List:String, Required: True

field

Type: String, Required: True

type

Type: List:String|String, Required: True

  • value
  • answers
    • answer

required

Type: Bolean, Required: True

Clone this wiki locally