Options
All
  • Public
  • Public/Protected
  • All
Menu

Module core/exam_specification

The general structure of an exam specification is:

IDs

Question, section, and exam specifications require unique IDs. (They must be unique within their individual component specification category - e.g. it would be ok to have a question and section with the same ID.)

Valid IDs must start with a letter and may contain letters, numbers, underscores, and dashes (i.e. they must match the regex /^[a-zA-Z][a-zA-Z0-9_\-]*$/). The isValidID function tests this.

Student "uniqnames" are also required to meet these same criteria.

When a question/section/exam is assigned to a student, it is given a UUID, with these original IDs used as part of the seed (assuming one of the deterministic UUID generation policies is used). So, don't change the IDs after you've started giving/grading an exam (or ideally don't change them EVER once a question is put into some use).

Specifying Question/Section Choosers

Questions within a SectionSpecification are given as a list of specific questions or QuestionChoosers that assign a (potentially different) subset of questions to each individual student. You may create custom question choosers or use predefined factory functions to create them:

Sections within an ExamSpecification are given as a list of specific sections or SectionChoosers that assign a (potentially different) subset of sections to each individual student. You may create custom section choosers or use predefined factory functions to create them:

Randomizing Question/Section Ordering

Use SHUFFLE to randomize the ordering (on a per-student basis) of a list of questions or sections.

Customizing Existing Specifications

Use the CUSTOMIZE function if you've got an existing specification (e.g. from a question bank) that you just need to tweak slightly.

Student information

Presently, the only information needed for students are names and "uniqnames", which are a unique identifier for each student. These must satisfy the same

Index

Type aliases

QuestionSpecification<QT>: { question_id: string; points: number; mk_description: string; response: ResponseSpecification<QT>; component_kind?: "specification"; title?: string; tags?: readonly string[]; skin?: ExamComponentSkin | SkinChooserSpecification; assets_dir?: string }

Type parameters

Type declaration

  • Readonly question_id: string

    A unique ID for the question. Must be distinct from all other question IDs. Also used as part of the composite seed for UUID generation by an ExamGenerator using the "plain" or "uuidv5" strategies.

  • Readonly points: number

    The number of points the question is worth overall.

  • Readonly mk_description: string

    Markdown-formatted question description.

  • Readonly response: ResponseSpecification<QT>

    The response for this question, which is the part of the question students interact with to enter their answer. Depending on the kind of response, this may also contain a significant amount of content as well.

  • Optional Readonly component_kind?: "specification"
  • Optional Readonly title?: string

    An optional question title.

  • Optional Readonly tags?: readonly string[]

    Tags for this question that may be used to pick it out of a question bank.

  • Optional Readonly skin?: ExamComponentSkin | SkinChooserSpecification

    A skin for this question, or a "chooser" that selects a skin from a set of possible skins. A question's skin is used in rendering its description and response.

    see

    core/skins

  • Optional Readonly assets_dir?: string

    An absolute path to a directory containing assets for this question. Assets will be available to the frontend at {{frontend_assets_dir}}/question/{{question_id}}/ where {{frontend_assets_dir}} is configured by the exam generator (defaults to "assets"). Tip: Use __dirname to get an absolute path to an assets folder located in the same directory as the file in which you define your specification. For example, __dirname + "/assets".

SectionSpecification: { section_id: string; title: string; mk_description: string; questions: readonly (QuestionSpecification | QuestionChooserSpecification)[]; component_kind?: "specification"; mk_reference?: string; skin?: ExamComponentSkin | SkinChooserSpecification; reference_width?: number; assets_dir?: string }

Type declaration

  • Readonly section_id: string

    A unique ID for the section. Must be distinct from all other section IDs. Also used as part of the composite seed for UUID generation by an ExamGenerator using the "plain" or "uuidv5" strategies.

  • Readonly title: string

    The section title.

  • Readonly mk_description: string

    Markdown-formatted section description, shown before its questions.

  • Readonly questions: readonly (QuestionSpecification | QuestionChooserSpecification)[]

    Specifies the sequence of questions in this section. Each entry in the array may either specify a particular question or a "chooser" that selects one (or more) from a set of possible questions that an individual student might be assigned.

    see

    QuestionSpecification

    see

    QuestionChooser

  • Optional Readonly component_kind?: "specification"
  • Optional Readonly mk_reference?: string

    Markdown-formatted section reference material, shown to the side of its description and questions.

  • Optional Readonly skin?: ExamComponentSkin | SkinChooserSpecification

    A skin for this section, or a "chooser" that selects a skin from a set of possible skins. A section's skin is used in rendering its description and response, and also affects the rendering of its questions (each question uses a compound skin created by layering its own skin on top of the section skin).

    see

    core/skins

  • Optional Readonly reference_width?: number

    The initial width, in percent 0-100, of the reference material for this section.

  • Optional Readonly assets_dir?: string

    An absolute path to a directory containing assets for this section. Assets will be available to the frontend at {{frontend_assets_dir}}/section/{{section_id}}/ where {{frontend_assets_dir}} is configured by the exam generator (defaults to "assets"). Tip: Use __dirname to get an absolute path to an assets folder located in the same directory as the file in which you define your specification. For example, __dirname + "/assets".

ExamSpecification: { exam_id: string; title: string; mk_intructions: string; sections: readonly (SectionSpecification | SectionChooserSpecification)[]; component_kind?: "specification"; mk_announcements?: string[]; mk_questions_message?: string; mk_download_message?: string; mk_saver_message?: string; mk_bottom_message?: string; enable_regrades?: boolean; assets_dir?: string }

Type declaration

  • Readonly exam_id: string

    A unique ID for the exam. Also used as part of the composite seed for UUID generation by an ExamGenerator using the "plain" or "uuidv5" strategies.

  • Readonly title: string

    Title shown at the top of the exam.

  • Readonly mk_intructions: string

    Markdown-formatted exam instructions, shown at the top of the exam.

  • Readonly sections: readonly (SectionSpecification | SectionChooserSpecification)[]

    Specifies the sequence of sections on this exam. Each entry in the array may either specify a particular section or a "chooser" that selects one (or more) from a set of possible sections that an individual student might be assigned.

    see

    SectionSpecification

    see

    SectionChooser

  • Optional Readonly component_kind?: "specification"
  • Optional Readonly mk_announcements?: string[]

    Markdown-formatted announcements that will be shown in an "alert" style box at the top of the exam, right below the main instructions. These are intended to stand out from the regular instructions.

  • Optional Readonly mk_questions_message?: string

    A markdown-formatted message that appears at the bottom left of the page, right above the "Answers File" button. A suggested use is to specify how students can ask questions during the exam, perhaps including a link to e.g. a course forum or video meeting with proctors.

  • Optional Readonly mk_download_message?: string

    A markdown-formatted message that appears at the bottom left of the page, right below the "Answers File" button. A suggested use is to remind students why to click the "Answers File" button, e.g. "Download an answers file to submit to Canvas".

  • Optional Readonly mk_saver_message?: string

    A markdown-formatted message that appears when students open the "Answers File" modal. A suggested use is to give students instructions for downloading and turning in their answers file.

  • Optional Readonly mk_bottom_message?: string

    A markdown-formatted message that appears at the bottom of the exam. A suggested use is to confirm that students have reached the bottom of the exam and remind them to download the answers file and turn it in elsewhere (e.g. to Canvas or some other LMS).

  • Optional Readonly enable_regrades?: boolean

    TODO this will probably be moved elsewhere.

  • Optional Readonly assets_dir?: string

    An absolute path to a directory containing assets for this exam. Assets will be available to the frontend at {{frontend_assets_dir}}/exam/{{exam_id}}/ where {{frontend_assets_dir}} is configured by the exam generator (defaults to "assets"). Tip: Use __dirname to get an absolute path to an assets folder located in the same directory as the file in which you define your specification. For example, __dirname + "/assets".

ExamComponentOrChooserSpecification: ExamComponentSpecification | ExamComponentChooserSpecification<"section"> | ExamComponentChooserSpecification<"question"> | ExamComponentChooserSpecification<"skin">
SectionChooserSpecification: ExamComponentChooserSpecification<"section">
QuestionChooserSpecification: ExamComponentChooserSpecification<"question">
SkinChooserSpecification: ExamComponentChooserSpecification<"skin">
SectionChooser: ExamComponentChooser<"section">
QuestionChooser: ExamComponentChooser<"question">
SkinChooser: ExamComponentChooser<"skin">
MinMaxPoints: MinMax & { _t_min_max_points?: never }
MinMaxItems: MinMax & { _t_min_max_items?: never }

Functions

  • isValidID(id: string): boolean
  • realizeChooser<CK>(spec: ExamComponentChooserSpecification<CK>): ExamComponentChooser<CK>
  • Type parameters

    • CK: ChooserKind

    Parameters

    • spec: ExamComponentChooserSpecification<CK>

    Returns ExamComponentChooser<CK>

Generated using TypeDoc