Custom Draft

Custom (Draft)

Allows developers to create custom Question types by providing their own JavaScript and CSS implementations.

The custom Question is referenced by its type in the code, which is "custom", along with a custom_type identifier.

Examples

{
    "type": "custom",
    "custom_type": "custom_shorttext",
    "js": {
        "question": "https://example.com/path/to/custom_question.js",
        "scorer": "https://example.com/path/to/custom_scorer.js"
    },
    "stimulus": "What is the capital of Ireland?",
    "validation": {
        "valid_response": {
            "score": 1,
            "value": "Dublin"
        }
    }
}

Attributes

  • custom_type string

    Defines a key that identifies this custom Question type.

  • js object

    Defines URLs to JavaScript files which define AMD modules for the question and scorer. See Creating Custom Questions article for more information.

  • js.question string

    A URL to a JavaScript file that defines an AMD module for rendering the Question.

  • js.scorer string

    A URL to a JavaScript file that defines an AMD module for scoring the Question.

  • type string

    Defines the Question type to be rendered. Must be set to "custom" in this case.

  • version string

    Identifies the version of the Question implementation.

  • css string

    A URL to a CSS file that defines styles for the Question.

  • instructor_stimulus string

    Additional notes for the educator that appears above the stimulus.

    For example, the content entered in this field could be used as notes during an assessment and could contain extra instructions that must be read out to the learners.

    This content will be shown when the showInstructorStimulus initialization option is set to true. HTML and simple Features are supported.

  • is_math boolean

    Indicates whether this Question contains math content.

    When set to true it will render LaTeX or MathML content with MathJax.

    You would want to use this when including math expressions in this Question type.

    Default: false

  • metadata object

    Additional information about the Question.

  • metadata.acknowledgements string

    Acknowledgements of the original creator(s) for any content used in the Question, such as, text passages, documents, images, etc.

  • metadata.distractor_rationale string

    Show individual response feedback (rationale) to the learner.

  • metadata.rubric_reference string

    A unique identifier for the rubric to be used with the Question. Defaults to the course rubric if it was assigned in the Activity configuration.

  • metadata.sample_answer string

    A sample answer to be shown in reporting with Learnosity Reports API. HTML is supported.

  • stimulus string

    The Question prompt shown to the learner. This can include text, tables, images, resources, and LaTeX entered via the math editor.

  • stimulus_review string

    Alternative content which will override the stimulus in review mode.

    This is intended as a field that contains an alternative/abbreviated version of the Question's stimulus, that will only show in review mode. This means that the content in this field is not visible to the learner, and it is also not possible to preview it using the Author Site. HTML and simple Features are supported.

  • ui_style object

    Controls different aspects of the UI.

  • ui_style.fontsize string

    Controls the size of the base font for the Question.

    Default: "normal"

    Possible values

    • "small"
    • "normal"
    • "large"
    • "xlarge"
    • "xxlarge"
  • ui_style.validation_stem_numeration string

    Numeration character to be shown to the left of the validation label.

    Note The character is only visible in the review state.

    Default: "number"

    Possible values

    • "number" - Numbered starting from "1".
    • "upper-alpha" - Uppercase letters starting from "A".
    • "lower-alpha" - Lowercase letters starting from "a".
  • validation object

    Configure the correct answer for the Question.

  • validation.valid_response array[string] string number object

    Defines the valid response and the total points awarded for the Question.

  • validation.valid_response.score number

    The points awarded for the correct response.

    Default: 1

  • validation.valid_response.value array[string] string number object

    See the Response format section below for more information.

Response format

The data returned in the response format for this Question depends on the custom Question type implementation.

Response format examples

{
    "response_attributes": {
        "value": "Dublin",
        "type": "custom_shorttext",
        "apiVersion": "v1.0",
        "revision": 1,
        "feedbackAttemptsCount": 0
    }
}

Response attributes

  • apiVersion string

    The version of the Questions API that returned this response.

  • feedbackAttemptsCount numeric

    Keeps track of the number of times the learner has clicked on "Check Answer".

  • revision numeric

    Keeps track of the number of Question attempts and submissions, meaning, how many times the learner answered the Question and submitted it.

  • type string

    Informs the scoring engine about what kind of data to expect in the values entered by the learner.

    Must be set to "array".

  • value object

    The response data returned by your custom Question implementation.

    The format and data type of this value depend on how the custom Question type is implemented and what data you capture from the learner's interaction.

Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.