H5P and xAPI (aka Tin Can)

falcon's picture

In the February Release of H5P the xAPI integration is introduced. H5P's current approach is to generate xAPI statements and make them available through javascript events.

The xAPI events are made available externally and also used by H5P internally. It is used between interactive video and the questiontypes for the interactivities and to calculate total scores, it is used by Questionset to know when a question has been attempted and by H5P core to store the total scores in the database.

For other web sites there is an amazing amount of oppurtunities created by the xAPI integration. Some things that may be done:

  1. Open new content the moment a prerequisite has been completed
  2. Implement a facebook like feed "James attempted the US Presidents Quiz" - "James completed the US Presidents Quiz with 45 out of 47 points!"
  3. Open a chat window between a student and a teacher the moment a student attempts a question
  4. With more statements added a teacher may step through everything a student did within a learning resource
  5. May be used to track what users of an interactive online advertisement does with the ad

To listen for events a developer adds somethink like:

H5P.externalDispatcher.on('xAPI', function(event) {console.log(event.data.statement)});

And she'll get all the events generated by H5P and may choose to store them, act upon them or just pass them along to another system.

Currently H5P triggers events for completed and attempted. A completed event looks like this:

{
"actor":{
"name":"falcon",
"mbox":"mailto:[email protected]",
"objectType":"Agent"
},
"verb":{
"id":"http://adlnet.gov/expapi/verbs/completed",
"display":{
"en-US":"completed"
}
},
"object":{
"id":"http://h5p.org/node/611",
"objectType":"Activity",
"extensions":{
"http://h5p.org/x-api/h5p-local-content-id":837
}
},
"result":{
"score":{
"min":0,
"max":3,
"raw":2
}
}
}

 

What do you think we should do next with our xAPI integration?

  1. Add more statements?
  2. Add integrations for popular LRSs like Learning Locker and Scorm Cloud?
  3. Add more data to our current statements like the users answers to a question?
  4. Anything else?

Great work guys. This is a big step forward. I'd love to see integrations with Learning Locker and maybe the 'success' property added to interactions too for the result field :)

falcon's picture

Noted! Thanks for reporting :) The success field probably will require settings for what score the user must obtain to achieve success, or do you think we could hard code it to 70 % or something?

I'm not sure how it would work for all content types, but in the Question Set content type there is already a 'Pass Percentage' field included. So the success boolean in the xAPI statement could be taken from that 

Attachments: 
falcon's picture

Yeah, questionset has that. I'll make a note of this and add success to questionset :)

I'm fairly certain that if you could somehow deliver a way for people to use powerpoints as starting point and then enchace content drawn from them, you would have potentially huge audience to catch. ISpring seems to be leader currently (?) in turning powerpoints to html5 and we are currently testing using "snippets" converted from powerpoint files by their software to html5 format and in between of those using exercises powered by h5p. If this process could be done any easier, that would be great - while powerpoint has its limitations, educators in all kind of organisations from universities to big companies have huge amount of material in them.

Not to be rude mmikko but how is this relevant to xAPI?

I'm not sure, but couldn't xAPI be used to deliver information about powerpoint events (like "the slideshow has ended" or "the slideshow is on page X")? 

This integration would be a great step forward as far as reporting is concerned.

We are currently looking into it. Anyway we can help ?

falcon's picture

Our current strategy is to make xAPI statements available for the publishing platform. A Learning Locker integration would then be a separate module for that platform that listens for the xAPI statements and sends them to learning locker. If you could create such a Drupal module or Wordpress plugin you would help us out a lot!

I am interested in helping on the Drupal die. We evaluated h5p and want to use it in an ongoing project, using both Drupal and Learning Locker as LRS. How can we get this thing running? How are you planning on making the statements available for the platform?

Not Drupal die. And no kittens, too. Should have been 'side' :D

falcon's picture

Yes, let's keep those kittens alive :) Currently we're only making the events available client side so you would add a script that listens for them and sends them to LearningLocker directly or via your server via ajax for improved security(server to server communications will make sure that the user in the statement is the logged in user)

You listen for statements with H5P.externalDispatcher.on('xAPI', yourHandler);

The statement itself will be in event.data.statement. The xAPI event also has some helper functions.

Hi there,

Do you know of anyone who is currently creating a Wordpress plugin that can handle the xAPI calls from H5P?

Thanks,

Mark

falcon's picture

Hi,

We're working with http://www.nextsoftwaresolutions.com/grassblade-xapi-companion/ now so hopefully their plugin will soon be able to handle H5P!

That's excellent news. Next Software are doing really good work in this area.

Mark

Hi!  Any updates with next software being able to read and store h5p content?  Thank you!

falcon's picture

We talked to them in september and solved some xAPI related bugs in our Wordpress plugin. I believe they are still working on it. I don't have any ETA

Great to hear that you are continuing to build on the xAPI functionality.

nolthafer's picture

Hi there.

We are sending xAPI statments to LL and are noticing that the output of the responses in the Learning Locker report is not in a useful format. Is there a way to "translate" those answer values into a more human readable format?

tim's picture

Hi! Have you tried making visualizations out of the responses? The data is not 'meant' to be very human readable but rather contain enough information for reports to be generated. 

nolthafer's picture

Hi Tim

No - we have not tried building dashboards in Learning Locker. We were hoping just to parse the answers into the .csv extract to start, similar to the solution detailed here (VLookup of the ID info from the tincan.xml file generated by Storyline export).

Right not, this is what we see in the result response field of the .csv extract from an H5P activity - 4[,]2[,]6

Not very helpful. We can see in the interaction details in LL what each of these values maps to but I'm hoping to get this somehow w/out building custom APIs or reports as our technical knowledge in working w/ these types of reports is very limited at the moment.

 

{

    "version": "1.0.0",

    "actor": {

        "objectType": "Agent",

        "account": {

            "name": "445d525e-3384-446f-bd10-bdfd479b1564",

            "homePage": "https://wisc-dev.pb.unizin.org/polisci160"

        }

    },

    "verb": {

        "id": "http://adlnet.gov/expapi/verbs/answered",

        "display": {

            "en-US": "answered"

        }

    },

    "object": {

        "objectType": "Activity",

        "id": "https://wisc-dev.pb.unizin.org/polisci160/wp-admin/admin-ajax.php?action=h5p_embed&id=1?subContentId=2bf13265-5edf-452c-ae11-679e012faeac",

        "definition": {

            "extensions": {

                "http://h5p.org/x-api/h5p-local-content-id": 1,

                "http://h5p.org/x-api/h5p-subContentId": "2bf13265-5edf-452c-ae11-679e012faeac"

            },

            "name": {

                "en-US": " \n\nTake a look back at the readings. Which of the fo..."

            },

            "description": {

                "en-US": "\u00a0\n\nTake a look back at the readings. Which of the following does Hobbes NOT discuss as an example of \"instrumental power?\"\n\u00a0\n"

            },

            "type": "http://adlnet.gov/expapi/activities/cmi.interaction",

            "interactionType": "choice",

            "correctResponsesPattern": [

                "4[,]2[,]6[,]1[,]7[,]0[,]5[,]3"

            ],

            "choices": [

                {

                    "id": "4",

                    "description": {

                        "en-US": "Affability\n"

                    }

                },

                {

                    "id": "2",

                    "description": {

                        "en-US": "Being feared\n"

                    }

                },

                {

                    "id": "6",

                    "description": {

                        "en-US": "Nobility\n"

                    }

                },

                {

                    "id": "1",

                    "description": {

                        "en-US": "Reputation for having power\n"

                    }

                },

               {

                    "id": "7",

                    "description": {

                        "en-US": "Eloquence\n"

                    }

                },

                {

                    "id": "0",

                    "description": {

                        "en-US": "Riches\n"

                    }

                },

                {

                    "id": "5",

                    "description": {

                        "en-US": "Reputation for prudence\n"

                    }

                },

                {

                    "id": "3",

                    "description": {

                        "en-US": "Success\n"

                    }

                }

            ]

        }

    },

    "context": {

        "contextActivities": {

            "parent": [

                {

                    "objectType": "Activity",

                    "id": "https://wisc-dev.pb.unizin.org/polisci160/wp-admin/admin-ajax.php?action=h5p_embed&id=1"

                }

            ],

            "category": [

                {

                    "objectType": "Activity",

                    "id": "http://h5p.org/libraries/H5P.MultiChoice-1.9"

                }

            ],

            "grouping": [

                {

                    "objectType": "Activity",

                    "id": "https://wisc-dev.pb.unizin.org/polisci160/chapter/hobbes-and-power-ii/",

                    "definition": {

                        "type": "http://activitystrea.ms/schema/1.0/page",

                        "name": {

                            "en": " | Hobbes and Power II"

                        },

                        "moreInfo": "https://wisc-dev.pb.unizin.org/polisci160/chapter/hobbes-and-power-ii/"

                    }

                }

            ]

        },

        "extensions": {

            "http://id.tincanapi.com/extension/ending-point": 1

        }

    },

    "result": {

        "score": {

            "min": 0,

            "max": 8,

            "raw": 3,

            "scaled": 0.375

        },

        "completion": true,

        "success": false,

        "duration": "PT3.83S",

        "response": "4[,]2[,]6"

    },

    "authority": {

        "objectType": "Agent",

        "name": "Unizin PressBooks Dev",

        "mbox": "mailto:[email protected]ker.net"

    },

    "stored": "2017-09-07T12:00:23.653800-05:00",

    "timestamp": "2017-09-07T12:00:23.653800-05:00",

    "id": "dfd801bb-b9ed-4721-b779-15691bc69534"

}

 

 

Thx

Nicole

tim's picture

Hi Nicole,

So the 'correctResponsePattern' is a comma seperated array of the correct responses according to the ids specified further down in the field. In this case it seems like all the answers are correct. 

Let's say you have 3 questions with the follwing id's:

1,2,3

but only 2 and 3 are correct. The correct response pattern would be 2[,]3.

You can have a look at the documentation here:
https://h5p.org/node/3428

for a bit more information about how the xAPI data is built up for MultiChoice.

It is possible to parse this data into a CSV file, the most pertinent information would be the 'description' section and the 'result' section. It will take some research but it shouldn't be more than a few lines of code.  

Let me know if you have any other questions! 

nolthafer's picture

Hi Tim

THanks for the response regarding parsing the data into a CSV, how would that happen? I'm only seeing 31 standard statements in Learning Locker to report on. Do you have ideas / recommendations on HOW to pull the description and result section out of Learning Locker? It's obviously stored there, just not sure how to report on it / pull the data.

Thx

Nicole

tim's picture

First, you have to export the data from Learning Locker. Then I would write a small javascript or python program to loop through the JSON and pull out the relevant data. 

If you would like to build a visualization on Learning Locker, I suggest having a look at their tutorials:

https://www.youtube.com/watch?v=T8RjzqrcP6A

tim's picture

You may not even have to write a program after all.. It seems like there are some online JSON to CSV converters:

https://konklone.io/json/

In any case, I would recommend speaking to a developer in your organization about this :)