Importing questions

We develop a site for a major UK university and they currently use WordPress with the Sensei plugin (https://seesensei.com/). This is now deprecated and was slowing the site down, so we are switching to H5P. We are looking at exporting all the Sensei questions (4,300) and then importing them in to H5P. It's early days and we have done no investigation yet but I was wondering if this was even a viable option to import these if we can get them in a matching data format?

otacke's picture

Hi Phil!

We do not have something like a general import interface (tool) -- although that'd be sweet :-)

On paper, it shouldn't be a show stopper. H5P files are just a bunch of zipped text files (+ images, etc.), and we have documentation describing their structure. If you download e.g. some H5P Mutliple-Choice content and unzip the file, you'll basically see the folders for all the libraries that are used by the content type and a file called h5p.json which describes the package for the H5P core. Those should be the same for every content type (of the same version).

You'll also see a folder called content which keeps the actual question. It may contain folders for media, but will definitely also contain a file called content.json. It defines a questions content (and uses semantics.json from the content types code as a template). You could open and modify it with an ordinary text editor, zip everything, and you would have changed your H5P content without the editor.

In conclusion, if you can export your seesensei questions to a structured format, it should not be hard to write a script that converts these into valid content.json files, adds the library folders and h5p.json and packs everything.

Best,
Oliver

serettig's picture

I've done some very basic work on creating a command line utility that is supposed to mass create h5p packages from the command line. I'm currently playing around with creating flashcards from csv files, but this can definitely be expanded to allow for other sources and other content types. You can find my current work here. The project is still in the proof-of-concept phase, so I wouldn't advise building on it yet, but I think depending on the amount of resources you want to spend, this is definitely a viable option.

I don't know how far WordPress can automate uploading h5p files, so this might be something you have to look into. Having to manually upload the converted h5p files wouldn't be fun.

otacke's picture

Hi!

I just gave it a try. Very nice! Keep going!

Best,
Oliver

It looks like adding questions to the content.json file is straightforward with one exception: subContentId.

It appears subContentId is GUID of some kind. How should I generate that for questions I'm importing into the file?

 

Thanks,

Steve

otacke's picture

https://github.com/h5p/h5p-php-library/blob/f08655cfb0f8f21cf79e92d8c28127ec9fe83177/js/h5p.js#L2264-L2274