This module reexports various functions, schemas and types relating to
blocks.
A block is used to express the metadata and logic of course
requirements. Blocks can be subdivided into multiple blocks which can be
reused in other course combinations.
The ay field is used to indicate the academic year of the course. Its value
should correspond to the calendar year of the first semester. For example, a
block representing course requirements for the AY21/22 cohort onwards should
have the ay field set to 2021.
It is only necessary to set the ay field for top-level blocks representing
courses. All child blocks are taken to have the same ay as their parent
block, unless specified otherwise.
Examples:
ay: 2020# course requirements for the AY20/21 cohort
The info field is used to alert the user to any important information. This
can be used in cases where the specified logic may not be sufficient to cover
the entirety of a course's requirements.
Examples:
info: "Please refer to the URL to verify that you meet the Faculty Requirements. Take note that some modules might fall under multiple subject groups."
The logic of a block can be viewed in three distinct stages: assign,
match and satisfy.
Each block begins with a list of modules, which may be all the modules
listed on the planner (for top-level blocks), or a subset of these modules
that have been filtered out by other blocks (for child blocks).
These modules are assigned to the specified blocks in the assign stage.
Remaining unassigned modules are passed to the match stage where
matching modules are assigned to the current block.
Lastly, all assigned and matched modules are passed to the satisfy stage
to ensure that the modules match a set of criteria.
Most blocks will have either an assign + satisfy stage or a match +
satisfy stage. In most cases, course requirements can be specified in a
straightforward manner using this three-stage logic flow.
The assign field can take either a string, representing a block identifier,
or an array of block identifiers.
Modules passed to the block are assigned to each of the specified blocks in
the assign field from the first block to the last block, with every module
assigned to at most one block.
Examples:
assign: ue# a single block with identifier "ue" assign: [ulr-2015, 1k, 2k, 3k-4k, fos-2015, ue] # six blocks with priority # from "ulr-2015" to "ue"
After the assign stage, the remaining modules are passed to the match
stage which consists of a list of match rules. The match field can take
either a single match rule or an array of match rules. By default, modules
will be matched if they meet any of the specified match rules.
Please refer to the matchRule module for more information on match rules.
Examples:
match: - and: # and match rule - or: [CS1010, CS1010S, CS1010X] # or match rule, taking in an array of # pattern match rules - DSA1101# pattern match rule - or: # or match rule - CS2103# pattern match rule # pattern match rule with info - pattern: CS2103T info: "Students taking CS2103T Software Engineering must take CS2101 Effective Communication for Computing Professionals in the same semester." # pattern match rule with exclude - pattern: "MA2xxx*" exclude: "MA23xx*"# this removes all modules matched by the previous # pattern, "MA2xxx*" that match "MA23xx*"
Lastly, the satisfy stage takes all modules that were assigned in the
assign stage or matched in the match stage and passes them to a list of
satisfy rules. The satisfy field can take either a single satisfy rule or
an array of satisfy rules. By default, a block with no satisfy rules is
taken to be satisfied and a block with multiple satisfy rules must
satisfy all of the rules.
Please refer to the satisfyRule module for more information on satisfy
rules.
Examples:
satisfy: - 4k-above# block ID satisfy rule - or: # or satisfy rule, with an array of satisfy rules - cs-hons-2020-alg/prim-match# block ID satisfy rule - cs-hons-2020-ai/prim-match - mc: ">=12"# MC satisfy rule
This module reexports various functions, schemas and types relating to blocks.
A block is used to express the metadata and logic of course requirements. Blocks can be subdivided into multiple blocks which can be reused in other course combinations.
Metadata Fields
name(optional)The
namefield is used to assign a name to a block. It can be used to store the name of the course or a specific section of its requirements.Examples:
ay(optional)The
ayfield is used to indicate the academic year of the course. Its value should correspond to the calendar year of the first semester. For example, a block representing course requirements for the AY21/22 cohort onwards should have theayfield set to 2021.It is only necessary to set the
ayfield for top-level blocks representing courses. All child blocks are taken to have the sameayas their parent block, unless specified otherwise.Examples:
url(optional)The
urlfield is used to provide a URL that links to the relevant course requirements.Examples:
info(optional)The
infofield is used to alert the user to any important information. This can be used in cases where the specified logic may not be sufficient to cover the entirety of a course's requirements.Examples:
isSelectable(optional)The
isSelectablefield is used to mark a block as selectable in the GUI. By default,isSelectableis taken to be false if not specified otherwise.Examples:
Logic Fields
The logic of a block can be viewed in three distinct stages:
assign,matchandsatisfy.assignstage.matchstage where matching modules are assigned to the current block.satisfystage to ensure that the modules match a set of criteria.Most blocks will have either an
assign+satisfystage or amatch+satisfystage. In most cases, course requirements can be specified in a straightforward manner using this three-stage logic flow.assign(optional)The
assignfield can take either a string, representing a block identifier, or an array of block identifiers.Modules passed to the block are assigned to each of the specified blocks in the
assignfield from the first block to the last block, with every module assigned to at most one block.Examples:
match(optional)After the
assignstage, the remaining modules are passed to thematchstage which consists of a list of match rules. Thematchfield can take either a single match rule or an array of match rules. By default, modules will be matched if they meet any of the specified match rules.Please refer to the matchRule module for more information on match rules.
Examples:
satisfy(optional)Lastly, the
satisfystage takes all modules that were assigned in theassignstage or matched in thematchstage and passes them to a list of satisfy rules. Thesatisfyfield can take either a single satisfy rule or an array of satisfy rules. By default, a block with nosatisfyrules is taken to be satisfied and a block with multiplesatisfyrules must satisfy all of the rules.Please refer to the satisfyRule module for more information on satisfy rules.
Examples:
Child blocks
Blocks can contain other blocks, which are constructed in a similar fashion to the top-level block.