Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • The Feature will be enabled/disabled for a particular category using the flag “allowBranching“ with the value “Yes/No

  • The flag allowBranching will be stored at object level schema with default to “No“ and same can be overridden for specific category at category definition level.

  • A dependent question can be added only for questions available within the immediate parent. It means we can't target question available with other parents within observation/survey hierarchy.

  • The rule (branchingLogic) will be available with the immediate parent (section or root node)

  • The branchingLogic will be stored 

    • in the hierarchy itself, if available at section/unit level. 

    • in the hierarchy & graph, if available at root level (Observation/Survey)

  • “branchingLogic“ will be added to QuestionSet object level schema as an optional property.

  • “branchingLogic” will be accepted by the platform only if “allowBranching” is set “Yes”.

  • Sample value of branchingLogic is as below:

Code Block
languagenone
{
  "allowBranching": "Yes",
  "branchingLogic": { // Renamed from render config
    "questionId_do_1": { // Only parent or child questions will be stored here.
      "target": [
        "questionId_do_2"
      ],
      "preCondition": {}
    },
    "questionId_do_2": {
      "target": [],
      "source": ["questionId_do_1"],
      "preCondition": {
        "and": [ // Use of JSON Logic library
          {
            "eq": [ // eq, ne, lt, gt, exists, not_exists, and, or
              {
                "var": "do_1.response1.value",
                "type": "responseDeclaration"
              },
              "0"
            ]
          }
        ]
      }
    }
  }
}

...

Code Block
{
  "request": {
    "data": {
      "nodesModified": {
        "section1": {
          "isNew": false,
          "root": false,
          "metadata": {
            "allowBranching": "Yes",
            "branchingLogic": {
              "q1": {
                "target": [
                  "q2"
                ],
                "preCondition": {} // this will be empty
              },
              "q2": {
                "target": [], // this will be empty 
                "preCondition": {} // this will have required rule.
              }
            }
          }
        },
        "q2": {} // metadata for question q2
      },
      "hierarchy": {
        "survey-1": {
          "name": "survey 1",
          "primaryCategory": "Survey",
          "children": [
            "section1"
          ],
          "root": true
        },
        "section1": {
          "name": "Section 1",
          "primaryCategory": "Survey",
          "children": [
            "q1",
            "q2"
          ],
          "root": false
        }
      },
      "lastUpdatedBy": "5a587cc1-e018-4859-a0a8-e842650b9d64"
    }
  }
}

...