Coursedog

Submit a Ticket My Tickets
Welcome
Login  Sign up

REQUIREMENTS: JSON Data Structure for Simple Requirements

Table of Contents
Overview
Terminology Overview
Schema Outline
Examples
Related Articles

Overview

  • This document provides an overview of the data structure for simple requirements, which are associated with courses and programs in Curriculum Management. 

  • This is particularly useful if you will be importing Requirements using our API.

  • Learn more about how Requirement works in Curriculum Management here

  • Reference our Curriculum API for more technical information.

Terminology Overview

Requirement Block

This is the basic building block of all requirements. Each requirement block contains meta information along with a list of rules.


Rule

  • Rules are built as part of a requirement block.

  • Rules are where all the requirement conditions and logic live.


Rule Condition

Each rule must have a condition that defines the context of the rule (e.g. Complete all of, any of, etc.).


Rule Value

The value(s) associated with a given rule (e.g. a list of courses).


Schema Outline

Overview |  Notes on Fields |  Schema Outline

Overview

Below is a schema outline of the requirements (requisites) data structure, with context about the following:

  • Type of field.

  • If there is a default value if the field is not provided.

  • If the field is optional (i.e. does not need to be provided in payload).

  • If there is conditional logic for when a field is optional or not.

Notes on Fields

id |  showInCatalog |  requirementBlock.notes & rule.notes |  rule.value
rule.condition |  rule.restriction |  rule.grade & rule.gradeType | rule.credits
rule.minCredits, rule.maxCredits, rule.minCourses & rule.maxCourses
 |  rules.subRules

id

  • Refers to a unique Coursedog ID.

  • If an id field is not provided, Coursedog will generate one.


showInCatalog

This must be set to true for the requirement to be visible in the public-facing catalog.


requirementBlock.notes & rule.notes

These fields support both plain text and HTML content.


rule.value

  • This property is an array that supports a few different types of structures for the array entities. 

  • Examples below demonstrate this.

  • When a “Course ID” is referenced in the rule.value property, this is referring to the course.courseGroupId property that exists on the course in Coursedog.


rule.condition

This property accepts the following values:

  • completedAllOf

  • completedAtLeastXOf

  • completedAnyOf

  • completeVariableCoursesAndVariableCredits

  • enrolledIn

  • minimumCredits

  • minimumGrade

  • averageGrade

  • freeformText

  • anyOf

  • allOf


rule.restriction

This property is only populated when the rule.condition is completedAtLeastXOf, and the rule.restriction represents the number of courses needing to be completed.


rule.grade & rule.gradeType

These properties are only populated when the rule.condition is minimumGrade or averageGrade.


rule.credits

This property is only populated when the rule.condition is minCredits.


rule.minCredits, rule.maxCredits, rule.minCourses & rule.maxCourses

These properties are only populated when rule.condition is completeVariableCoursesAndVariableCredits.


rules.subRules

This is an array of child rules, where each child rule has the same data structure as the parent rule.


Schema Outline

{
  requisites: {
    requisitesSimple: [
      object({
				// the following are fields for the requirement block
        id: string().default(generateUniqueId()),
        name: string().default(''),
        type: string().default(''),
        notes: string().default(''),
        showInCatalog: boolean(),
        requirementLevel: string().optional(),
        planCode: string().optional(),
        position: number().integer().optional(),
        rules: array().items(
          object({
						// the following are fields for the rule
            id: string().default(generateUniqueId()),
  		      name: string(),
            notes: string(),
            condition: string(),
            restriction: number(),
            number: number(),
            grade: string(),
            gradeType: string(),
            credits: number(),
            minCredits: number().integer().optional(),
            maxCredits: number().integer().when('minCredits', {
              is: exist(),
              then: number().min(ref('minCredits')).optional(),
              otherwise: optional(),
            }),
            minCourses: number().integer().optional(),
            maxCourses: number().integer().when('minCourses', {
              is: exist(),
              then: number().min(ref('minCourses')).optional(),
              otherwise: optional(),
            }),
            value: [
              string(),
              object({
                id: string(),
                condition: string(),
                restriction: number(),
                number: number(),
                text: string(),
                values: array().items(
                  string(),
                  object({
                    logic: string().required(),
                    value: array().items(string()).min(0).required(),
                  }),
                ).default([]),
                subSelections: array(),
            ],
            subRules: array(),
        ).default([]),
      })
    }
  ]
}

Examples

Simple Example 1 | Simple Example 2 | Example with Variable Credits
Example with AND/OR Course Conditions
 | Example with Nested Sub Rules

Simple Example 1

Overview

The following example contains a single requirement block, and that requirement block contains a single “complete all of” rule condition. The rule contains a list of courses. 


Coursedog UI

Corresponding JSON Data Structure

{
   "requisites":{
      "requisitesSimple":[
         {
            "id":"rxxYmvz3",
            "name":"General Education Requirements",
            "type":"Completion Requirement",
            "showInCatalog":true,
            "notes":""
            "rules":[
               {
                  "id":"nbDG9Vma",
									"name":"Anthropology",
									"notes": "<p>Complete all these courses within your first two semesters. </p>"
                  "condition":"completedAllOf",
                  "value":{
                     "condition":"courses",
                     "id":"AFHSl4sy",
                     "values":[
                        {
                           "value":[
                              "N9l52uDqxkYL0J7ubkFH"
                           ],
                           "logic":"and"
                        },
                        {
                           "value":[
                              "m0IntbiY89z0HFCdubUb"
                           ],
                           "logic":"and"
                        },
                        {
                           "value":[
                              "bYIsNbyjvJ0Osazixj6r"
                           ],
                           "logic":"and"
                        }
                     ],
                     "subSelections":[]
                  },
               }
            ],
         }
      ]
   }
}


Simple Example 2

Overview

The following example contains a single requirement block, and that requirement block contains a single “complete at least X of” rule condition. The rule contains a list of courses. 


Coursedog UI


Corresponding JSON Data Structure

{
   "requisites":{
      "requisitesSimple":[
         {
            "id":"rxxYmvz3",
            "name":"General Education Requirements",
            "type":"Completion Requirement",
            "showInCatalog":true,
            "rules":[
               {
                  "id":"nbDG9Vma",
                  "name":"Anthropology",
                  "notes":"<p>Complete at least two of these courses. </p>",
                  "restriction":2
                  "condition":"completedAtLeastXOf",
                  "value":{
                     "condition":"courses",
                     "values":[
                        {
                           "value":[
                              "N9l52uDqxkYL0J7ubkFH"
                           ],
                           "logic":"and"
                        },
                        {
                           "value":[
                              "m0IntbiY89z0HFCdubUb"
                           ],
                           "logic":"and"
                        },
                        {
                           "value":[
                              "bYIsNbyjvJ0Osazixj6r"
                           ],
                           "logic":"and"
                        }
                     ],
                     "id":"AFHSl4sy",
                     "subSelections":[
                        
                     ]
                  },
               }
            ],
            "notes":""
         }
      ]
   }
}__


Example with Variable Credits

Overview

The following example contains a single requirement block, and that requirement block contains the “Complete variable courses and variable credits” rule condition. The rule contains a list of courses and indicates a range of credits.  


Coursedog UI


Corresponding JSON Data Structure

{
   "requisites":{
      "requisitesSimple":[
         {
            "id":"rxxYmvz3",
            "name":"General Education Requirements",
            "type":"Completion Requirement",
            "showInCatalog":true,
            "notes":""
            "rules":[
               {
                  "id":"nbDG9Vma",
                  "condition":"completeVariableCoursesAndVariableCredits",
					        "name":"Bio-Engineering",
                  "minCourses":1,
                  "maxCourses":3,
                  "minCredits":9,
                  "maxCredits":12
                  "value":{
                     "condition":"courses",
                     "values":[
                        {
                           "value":[
                              "Pa7yfiqpkUaogM7Hybgo"
                           ],
                           "logic":"and"
                        },
                        {
                           "value":[
                              "OafqtZ3hW8NfnfDzpx0W"
                           ],
                           "logic":"and"
                        },
                        {
                           "value":[
                              "m6YgjJ6W4dwjKsywkoH1"
                           ],
                           "logic":"and"
                        },
                        {
                           "value":[
                              "BwmsJFiN6WivUy3x1gdZ"
                           ],
                           "logic":"and"
                        }
                     ],
                     "id":"GihHPLjI",
                     "subSelections":[
                        
                     ]
                  },
               }
            ],
         }
      ]
   }
}



Example with AND/OR Course Conditions

Overview

The following example contains a single requirement block, and that requirement block contains the “Minimum Credits” rule condition. The rule contains a list of courses and includes an “or” condition. 


Coursedog UI


Corresponding JSON Data Structure

{
   "requisites":{
      "requisitesSimple":[
         {
            "id":"rxxYmvz3",
            "name":"General Education Requirements",
            "type":"Completion Requirement",
            "showInCatalog":true,
            "notes":""
            "rules":[
               {
                  "id":"nbDG9Vma",
                  "condition":"minimumCredits",
                  "name":"Bio-Engineering",
                  "credits":12
                  "value":{
                     "condition":"courses",
                     "values":[
                        {
                           "value":[
                              "Pa7yfiqpkUaogM7Hybgo"
                           ],
                           "logic":"and"
                        },
                        {
                           "value":[
                              "OafqtZ3hW8NfnfDzpx0W"
                           ],
                           "logic":"and"
                        },
                        {
                           "value":[
                              "m6YgjJ6W4dwjKsywkoH1",
                              "BwmsJFiN6WivUy3x1gdZ"
                           ],
                           "logic":"or"
                        }
                     ],
                     "id":"GihHPLjI",
                     "subSelections":[
                        
                     ]
                  },
               }
            ],
         }
      ]
   }
}


Example with Nested Sub Rules

Overview

The following example contains a single requirement block, and that requirement block contains the “Fulfill All Of” rule condition, with two sub-rules.  


Coursedog UI


Corresponding JSON Data Structure

{
   "requisites":{
      "requisitesSimple":[
         {
            "id":"rxxYmvz3",
            "name":"General Education Requirements",
            "type":"Completion Requirement",
            "showInCatalog":true,
						"notes":""
            "rules":[
               {
                  "id":"nbDG9Vma",
                  "condition":"allOf",
                  "name":"Requirement With Sub Rules",
                  "subRules":[
                     {
							          "id":"GsiRPtpi",
                        "name":"Sub Rule 1"
                        "condition":"completedAllOf",
                        "value":{
                           "condition":"courses",
                           "values":[
                              {
                                 "value":[
                                    "AjVfeCFjcKdwbO0mcbi0"
                                 ],
                                 "logic":"and"
                              },
                              {
                                 "value":[
                                    "Pa7yfiqpkUaogM7Hybgo"
                                 ],
                                 "logic":"and"
                              }
                           ],
                           "id":"FqSIJgfx",
                           "subSelections":[
                              
                           ]
                        },
                     },
                     {
												"id":"6PSMc9Fw",
                        "name":"Sub Rule 2",
                        "restriction":2
                        "condition":"completedAtLeastXOf",
			                  "restriction":2,
                        "value":{
                           "condition":"courses",
                           "values":[
                              {
                                 "value":[
                                    "eEuLSPeDdM4cNVrdtQ6g"
                                 ],
                                 "logic":"and"
                              },
                              {
                                 "value":[
                                    "NDjwkVxwppvKuNQH2r8j"
                                 ],
                                 "logic":"and"
                              },
                              {
                                 "value":[
                                    "WHmWk1jtSx0oFXv1m8U2"
                                 ],
                                 "logic":"and"
                              }
                           ],
                           "id":"N40AarWy",
                           "subSelections":[
                              
                           ]
                        },
                     }
                  ],
               }
            ],
         }
      ]
   }
}

Related Articles


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.