adaptlearning / adapt-contrib-xapi

TinCan/xAPI extension for the Adapt Framework
GNU General Public License v3.0
12 stars 27 forks source link

Support cmi5 specification #124

Open k-jensen opened 9 months ago

k-jensen commented 9 months ago

Subject of the issue/enhancement/features

Add support for the cmi5 specification.

1.0 Overview

cmi5 Implementation Flow for an AU (Assignable Unit) image

(Figure from https://aicc.github.io/CMI-5_Spec_Current/flows/au-flow.html)

2.0 Requirements

To support cmi5, the extension should enable an Adapt course to:

https://github.com/AICC/CMI-5_Spec_Current/blob/quartz/cmi5_spec.md#70-au-requirements

3.0 Acronyms

4.0 Runtime Flow

What should happen when an Adapt course is launched from an LMS. (With the adapt-contrib-xapi extension enabled and _specification set to "cmi5")

4.1 Read the URL params

The LMS should launch the adapt course with the following query params:

:neckbeard::question: How should we save these values? Set as model attributes on https://github.com/adaptlearning/adapt-contrib-xapi/blob/master/js/XAPI.js

4.2 Get the Auth Token

Before trying to communicate with the LRS, we need to used the fetch value provided by the LMS to get an authentication token.

The response should contain a JSON object with an auth-token property e.g.

{
  "auth-token": "QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
}

This auth-token should then be used in all requests made to the LRS.

4.3 Set the xapiWrapper config

This plugin uses the xAPIWrapper.js library. https://github.com/adlnet/xAPIWrapper

When loaded, the xAPIWrapper will check for some query params.

We need to do a little extra to handle our auth-token and activityId e.g.

  this.xapiWrapper.changeConfig({
    auth: `Basic ${this.get('auth-token')}`,
    activity_id: this.get('activityId')
  })

4.4 Read State Document

When launched the LMS will write a state document with details needed for the AU to send valid xAPI statements during it's session. https://github.com/AICC/CMI-5_Spec_Current/blob/quartz/cmi5_spec.md#xapi_state

Example of LMS.LaunchData:

{
  "launchMode": "Normal",
  "masteryScore": 0.7,
  "moveOn": "Passed",
  "contextTemplate": {
    "contextActivities": {
      "grouping": [
        { "id": "http://www.example.com/LA1/001" }
      ],
      "extensions": {
        "https://w3id.org/xapi/cmi5/context/extensions/sessionid": "1234567890"
      }
    },
    "entitlementKey": {},
    "launchParameters": "Start=1,QuizMode=1,FastForward=On",
    "returnURL": "http://lms.example.com/returnURL.html"
  }
}

https://github.com/AICC/CMI-5_Spec_Current/blob/quartz/cmi5_spec.md#1021-contexttemplate

10.2.1 contextTemplate

The AU MUST get the contextTemplate value from the LMS.LaunchData State document. The AU MUST NOT modify or delete the LMS.LaunchData State document. The AU MUST use the contextTemplate as a template for the context property in all xAPI statements it sends to the LMS. While the AU MAY include additional values in the context object of such statements, it MUST NOT overwrite any values provided in the contextTemplate. NOTE: this will include the session ID specified by the LMS.

4.5 Read Agent Profile

https://github.com/AICC/CMI-5_Spec_Current/blob/quartz/cmi5_spec.md#110-xapi-agent-profile-data-model

4.6 Order of xAPI Statements

4.7 Return to URL

https://github.com/AICC/CMI-5_Spec_Current/blob/quartz/cmi5_spec.md#1026-returnurl

5.0 Properties schema update

5.1 Config

  "_specification": {
    "type": "string",
    "enum": [
      "xAPI"
    ],
    "default": "xAPI",
    "title": "Specification",
    "inputType": {
      "type": "Select",
      "options": [
        "xAPI",
        "cmi5"
      ]
    },
    "validators": [],
    "help": "Indicates whether the plugin should use standard xAPI or cmi5 profile."
  },
    "validators": [],
    "help": "(cmi5 only) Some useful help text."
},

https://github.com/AICC/CMI-5_Spec_Current/blob/quartz/cmi5_spec.md#moveon https://github.com/AICC/CMI-5_Spec_Current/blob/quartz/cmi5_spec.md#9622-moveon-category-activity

6.0 Post Build actions

6.1 cmi5.xml - The Course Structure

7.0 Resources

x.x TODO: make notes about...