Coder Social home page Coder Social logo

scorm-to-xapi-wrapper's Introduction

SCORM-to-xAPI-Wrapper

This project contains a modified SCORM Version 1.2 APIWrapper.js file, a modified SCORM 2004 APIWrapper.js file and a new SCORMToXAPIFunctions.js file that handles automated conversion of SCORM Data Model elements to associated xAPI statements. This wrapper implements the SCORM Data Model conversion as defined in the Experience API SCORM Profile. This document is in draft form. Changes will be made to this wrapper to coincide with changes to the xAPI SCORM Profile.

For detailed technical information on xAPI, read the Experience API Spec

Note that using these wrappers WILL result in xAPI statements about your learners in an LRS. ENSURE THAT YOU UNDERSTAND YOUR LRSs PRIVACY AND SECURITY FEATURES BEFORE IMPLEMENTING THIS APPROACH.

SCORM2004/APIWrapper.js

Javascript SCORM 2004 API wrapper with new xAPI object (Implemented in SCORMToXAPIFunctions.js).
This javascript file is typically used in SCORM 2004 courses. If the ADL-provided ADLWrapper.js file is used in your SCORM courses, it can be replaced with this file.

Note: The updated APIWrapper.js file does not stand-alone and MUST be used with the SCORMToXAPIFunctions.js file.

SCORM1.2/APIWrapper.js

NOTE - THIS VERSION IS CURRENTLY OUT OF DATE. PLEASE SEE THE 2004 WRAPPER UNTIL THIS ISSUE IS ADDRESSED.

Javascript SCORM 1.2 API wrapper with new xAPI object (Implemented in SCORMToXAPIFunctions.js).
This javascript file is typically used in SCORM 1.2 courses. If the ADL-provided ADLWrapper.js file is used in your SCORM courses, it can be replaced with this file.

Note: The updated APIWrapper.js file does not stand-alone and MUST be used with the SCORMToXAPIFunctions.js file.

SCORMToXAPIFunctions.js

JavaScript file that implements an "xapi" object that abstracts implementation details of the xAPI SCORM Profile. This object is integrated into the APIWrapper.js file in order to automatically convert SCORM Run-Time communication to associated xAPI statements.

This version of the wrapper supports SCORM 2004 and SCORM 1.2.

Dependencies

The SCORM-to-xAPI-Wrapper relies on external dependencies to perform some actions. Make sure you download the minified xAPI Wrapper to be included in your legacy SCORM courses. Information on integration of this file is included in the Configuration section below.

Configuration

To update your SCORM 2004 courses to additionally track xAPI statements replace the appropriate APIWrapper.js file (1.2 or 2004 version depending on your SCORM version) with the SCORM-to-xAPI-Wrapper and include two new files:

  • the standard xapiwrapper.min.js file listed in the dependency above
  • the new SCORMToXAPIFunctions.js file included in this projecct

Next, add the following code in the <head> sections of each SCO in your course. SCO launch files can be identified by looking at the imsmanifest.xml file at the root of the SCORM package. Resource elements with adlcp:scormtype set to "sco" should contain the complete list of SCOs in the course. Each SCO will be an 'activity' tracked by xAPI statements. Paste the following code before the <script> tag that references the APIWrapper.js file.

<script type="text/javascript">
  var activity = document.location.protocol + "//" + document.location.host + document.location.pathname;
</script>
<script type="text/javascript" src="../Shared/JavaScript/xapiwrapper.min.js"></script>
<script type="text/javascript" src="../Shared/JavaScript/SCORMToXAPIFunctions.js"></script>

Notes:

  • Be sure that the path in the src attribute above points to the location of the minified xapiwrapper.min.js and SCORMToXAPIFunctions.js file. This location assumes that one directory up from the SCO location, that there is a Shared/JavaScript directory with your JavaScript files.
  • Activity IDs will be automatically generated based on the URL of the SCO. This may be LMS-dependent, so it is also possible to manually configure your activity URIs by changing a line of javascript code in each SCO. This will also ensure that your activity IRIs do not change when you import a new copy of the course or include the same course in an additional LMS. To optionally configure your activity URI's make the following update:
var activity = <manually configured URI goes here>;
// ex. var activity = "http://adlnet.gov/courses/example/module1"

Finally, several configuration values must be set in the updated APIWrapper.js file (init method). Instructions are also included in the header at the top of the JavaScript file. Near the top of the file, configure the following lines of code:

 var config = {
    lrs:{
       endpoint:"https://lrs.adlnet.gov/xapi/",
       user:"<lrs user>",
       password:"<lrs password>"
    },
    courseId:"<course identifier/uri>",
    lmsHomePage:"<lms homepage>"
 };

Limitations

Currently, the SCORM to xAPI Wrapper handles a subset of SCORM Run-Time behaviors and data model elements. This list will be expanded over time. Currently, the wrapper supports:

The following data model elements or behaviors result in associated xAPI statements:

Core SCO Data

  • cmi.score.scaled
  • cmi.success_status
  • cmi.completion_status
  • cmi.exit

Interactions Data

  • cmi.interactions.n.id
  • cmi.interactions.n.type
  • cmi.interactions.n.description
  • cmi.interactions.n.learner_response

Behaviors

  • SCO Initialize
  • SCO Terminates
  • SCO Resumes
  • SCO Suspends

The following data is stored as either profile or state information

Activity Profile

Identified by:

Data:

  • completion_threshold (value of cmi.completion_threshold data)
  • launch_data (value of cmi.launch_data)
  • max_time_allowed (value of cmi.max_time_allowed)
  • scaled_passing_score (value of cmi.scaled_passing_score)
  • time_limit_action (value of cmi.time_limit_action)

Activity State

Identified by:

Data:

  • attempts (Ordered list of attempt IRIs found as context in statements)

Attempt State

Identified by:

Data:

  • location (value of cmi.location)
  • preferences (see below for preferences data type)
  • credit (value of cmi.credit)
  • mode (value of cmi.mode)
  • suspend_data (value of cmi.suspend_data)
  • total_time (value of cmi.total_time)

Preferences Data Type (see reference above)

  • language (value of cmi.learner_preference.language)
  • audio_level (value of cmi.learner_preference.audio_level)
  • delivery_speed (value of cmi.learner_preference.delivery_speed)
  • audio_captioning (value of cmi.learner_preference.audio_captioning)

It is strongly recommended that implementers read and understand the Experience API SCORM Profile. Additional data model elements and behaviors identified in this profile will be implemented in a subsequent version.

Contributing to the project

We welcome contributions to this project. Fork this repository, make changes and submit pull requests. If you're not comfortable with editing the code, please submit an issue and we'll be happy to address it.

License

Copyright ©2016 Advanced Distributed Learning

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

scorm-to-xapi-wrapper's People

Contributors

creighton avatar jhaag75 avatar jono-poltrack avatar jonopoltrack avatar ljwolford avatar pauliejes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scorm-to-xapi-wrapper's Issues

Abstract account json so it is created in one place

Some implementations may want to use mbox instead of an LMS account. Now, the code requires this change to be made in several places throughout SCORMToXAPIFunctions.js. Abstract this JSON snippet creation and reuse it in each of these places so its each to swap out with an mbox

Email Address

Hi There,

Does the email address from the LMS get sent to the LRS

Regards,

Stephen

Replace SCORM with xAPI

Hi @jonopoltrack

I want to know if this can be used to covert SCORM to xAPI content, instead of additionally sending xAPI Statement.

There are many who want to host SCORM content on an xAPI platform like on WordPress using our GrassBlade xAPI Companion plugin. And, it can be done one if the SCORM requirements are removed.

Pankaj

ADLnet constants endpoint 404 error

Hi,
I'm just looking at implementing this (or using it as a basis for a custom implementation) and after the initial setup am getting a 404 for any requests to the adlnet endpoints:
Anything to http://adlnet.gov/xapi and sub locations e.g, http://adlnet.gov/xapi/profile/scorm/activity-state all fail with an nginx 404.

Do you know if this address has moved and to where?
I can see that the SCORMToXAPIFunctions.js code setting the constants object is where it is falling down for me.

Any help would be appreciated.
Simon

Was this abandoned?

Looks like references to future fixes are displayed but noting has happened for quite some time. Was this picked back up in another repository? This functionality is exactly what I need.

Thanks

Mike

Scorm player

Hello friends,
I'm trying to develop a scorm player that sends to mysql, has anyone done anything like this? Thank you.

interaction timing

Fully implement the interactions array

AND - make a user-configurable value that is the trigger that makes the xAPI statement send. For example, when the "learner_response" is set, then send the interaction.

SCORM 2004 Resources Updated but not 1.2

The SCORM 2004 resources have been updated to move the initialization of the LRS information, authority and other context out of the JS files (to the LMS). The SCORM 1.2 files are now out of date and require a similar update.

The readme has been updated to indicate this change.
When the 1.2 resources are updated, remove this statement from the readme.

Readme updates

Update readme so it has

  1. Instructions if you do not use (or use a modified version) of the apiwrapper.js scorm file
  2. Update the limitations section once more data model elements are added - #13
  3. Instructions for how to configure via the manifest vs. manually - #15

Initialization of "launch_data" is the only way to set xapi mandatory info

Right now, the adlcp:dataFromLMS element is the only way to create the json object used to initialize the values needed for an xAPI statement (lrs info, activity id, scorm version, etc).

Need to keep this, but allow the user to choose to NOT use dataFromLMS and instead set these values on their own.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.