Connecting to a data source ?

Hi there,

I am completely a new to h5p. Before starting giving a try to develop a h5p applet, I would like your advice on my use case.

Currently I am generating hundred of exercices and quizz for Moodle with a simple Python script. I explain : the context of use is linguistics and grammar learning for language students.  I am considering using h5p to provide more features like graphically displaying syntactic trees, syntactic dependencies, providing more sophisticated exercices that simple quizz, etc.

Approach :

  1. a linguistically annotated corpora (for instance in the CoNLL format) containing hundred of sentences
  2. a python script that reads those sentences and generates appropriate quizz in the GIFT Moodle format
  3. manual importing of the quizz into Moodle web site

Ideally I would like to develop a single H5P applet that reads different question datasets in order to produce as many exercices, instead of generating as many h5p static applets.

Hence my question : can a h5p applet read from database ? I assume that the h5p cannot read from another domain url (CORS security constraint) ? How would you see the way to read the data feeding the h5p applet ? Files stored on server side ? In this last case each applet must be transmitted an exercice index to read the correct exercise data in the file; can it be done easily ?

Sorry for my naïve questions but I have no experience with h5p; so far I have jsut installed drupal7 and the h5p plugin in dev mode.

Thank you

E.

 

otacke's picture

Hi!

In theory: yes. H5P is merely a bunch of JavaScript that can do whatever JavaScript can do (from within an iframe, but that's probably not relevant for your use case), within CORS boundaries, etc.

In practice, however, H5P content is supposed to be shareable and to run anywhere without modification. That means that the server that hosts the database either should have an open API or you'd need to put your credentials into the H5P content type. I suppose you don't want to do the latter :-)

A workaround may be to dynamically modify a content's parameters either inside the database of the host system (but again ignoring H5P's idea of shareability) or maybe even client-side at runtime before the content is instantiated (but that may be tricky or not possible at all).

Cheers,
Oliver

Thank you for your answer.

I wonder whether there is a way to transmit a parameter when inserting the h5p applet in the web page, that could solve my problem.

I read that H5P has the concept of editor to create content, would it be an approach to solve my problem ? Say given a given h5p applet, packaging it with specific data that would make the applet unique. Well it would like creating as many h5p applets as questions to be answered. It does not follow the economy principle. However there will be hundred of questions, managing this in Wordpress or Moodle may not be as simple as importing a GIFT file dispatching questions into Moodle categories.

I could embedded all the questions in a single h5p applet but then I wonder how the Moodle integration would collect and transmit the answers to questions embedded into the applet.

Thank you for shedding light on that matter !

E.

 

otacke's picture

Hi Elie!

I am not completely sure if I understand your questions, but I'll try my best.

"I wonder whether there is a way to transmit a parameter when inserting the h5p applet in the web page, that could solve my problem."

That's what I mentioned ("client-side at runtime before the content is instantiated"). H5P will, of course, get the parameters from the database and they are put into page source as a variable that JavaScript can access. One could, in theory, use the alter_scripts hook in some additional plugin to run before the content is instantiated but after the parameters have been written in order to manipulate them - but that's the tricky part that I don't know whether it's possible.

"I read that H5P has the concept of editor to create content, would it be an approach to solve my problem ? Say given a given h5p applet, packaging it with specific data that would make the applet unique. Well it would like creating as many h5p applets as questions to be answered."

Yes. That will work. You can programatically add as many contents to the database as you like (which is the same as using the visual editor), or you can do the same by packing files of content and uploading that to the system.

"It does not follow the economy principle. However there will be hundred of questions, managing this in Wordpress or Moodle may not be as simple as importing a GIFT file dispatching questions into Moodle categories."

The H5P core team seems to have given higher priority to easy shareability of content across very different platforms instead of following to some economy principly that could be applied would one only run on one platform and not have to bother about how things might run elsewhere.

"I could embedded all the questions in a single h5p applet but then I wonder how the Moodle integration would collect and transmit the answers to questions embedded into the applet."

That depends on how you'd implement transmission of answers. If you have a look at Interactive Video or some other compound content type, you'll notice that all the sub contents' answers and scores can be reviews on moodle.

Cheers,
Oliver

Thank you Oliver. I think you gave me the relvant answers to follow investigation leads that cold solve my issue.

Cheers, Elie