slideDown

Friday, June 19, 2015

Using WeBWorK questions in Moodle quizzes -- the Moodle/WeBWorK question bridge

This is a copy of a post that I made to the Moodle forum on Quizzes.

I’m happy to announce a version of WeBWorK that can serve mathematics questions via a Moodle quiz.  This gives a tighter connection between Moodle and WeBWorK, allowing students to work exclusively with the Moodle quiz interface while WeBWorK produces the mathematics questions and processes the student answers in the background.  The result is similar to using STACK to produce and process mathematics questions.

This is a first attempt at realizing the question level WeBWorK-Moodle bridge which I proposed in this forum in my earlier post last January ( https://moodle.org/mod/forum/discuss.php?d=277922) and on my blog (http://michaelgage.blogspot.com/2015/01/connecting-webwork-to-moodle-2xs.html )

It makes most of the 25K+ mathematics questions written for WeBWorK’s OpenProblemLibrary (http://webwork.maa.org/wiki/Open_Problem_Library) available for use in Moodle quizzes as well.  The OPL began with questions designed for single and multivariable calculus courses (and that is still the majority of the collection) but has expanded in both up and down to include questions for linear algebra and differential equations, complex variables, operations research, and statistics; as well as precalculus and developmental mathematics problems and many other math subjects.

To see this Moodle/WeBWorK connection in action,  view the Moodle course for linear algebra and differential equations at (https://devel3.webwork.rochester.edu/moodle/course/view.php?id=21).  You will need to login as “visitor”, using the password “visitor” in order to view the quizzes. (Guests are not allowed to view Moodle quizzes.)

This is  a mockup of the matrix algebra/ODE course which I taught in 2009 using the Moodle/WeBWorK assignment connection (which presents an entire homework assignment using the WeBWorK interface).  In each week  you’ll see the original WeBWorK assignment that I used (the icon is a yellow spider web on blue background) and near it the Moodle Quiz version of the same assignment.  Try each of them to get a comparison between the WeBWorK/Moodle assignment bridge and the new WeBWorK/Moodle question bridge.

I have set the behavior of the Moodle Quiz so that it closely approximates the original WeBWorK assignment.  These assignments are meant primarily for homework/practice not for normative assessment.  The student can retry each question as often as she wishes and if there are several answer blanks then evaluation is given separately for each blank.

The Moodle portion of this bridge is built on the Opaque question type module implemented by Tim Hunt for interfacing with webservice test engines.  I am indebted to Tim for help and advice while I was implementing this Moodle/WeBWorK question interface.

Information for installing and configuring the Moodle Opaque question type is available on github at https://github.com/moodleou.  Specifically you need the opaque qtype module:  https://github.com/moodleou/moodle-qtype_opaque and the opaque behaviour module:  https://github.com/moodleou/moodle-qbehaviour_opaque.

I’ll provide more detailed suggestions for creating your own Moodle/WeBWorK questions later but for those somewhat familiar with both WeBWorK and Moodle here is the short explanation.
1. You create a new Opaque engine pointing to the url: https://devel3.webwork.rochester.edu/opaqueserver_wsdl and set the question bank URL for the engine to https://devel3.webwork.rochester.edu/webwork2/spring09mth165 .
2. For each question the questionID should be the same as the path of a WeBWorK problem in the OpenProblemLibrary with the following replacements.
The initial segment should be “library” instead of “Library”, each slash is replaced by two underscores, and each hyphen is replaced by three underscores. (This is required in order to conform to the Opaque client naming scheme.)
For example:
Library/Rochester/setAlgebra01RealNumbers/lhp1_31-34_mo.pg
is obtained using the questionID:
library__Rochester__setAlgebra01RealNumbers__lhp1_31___34_mo.pg

For those who are really impatient the WeBWorK server function is provided by adding the project opaque_server along side a standard WeBWorK course. The Opaque Server can be found at (https://github.com/openwebwork/opaque_server) along with minimal documentation for installing.  

This is the first version of the Moodle/WeBWorK question bridge so the behavior may change slightly in the future.  Because STACK and WeBWorK are already very similar I would be interested in creating a question type that was interchangeable between the two background mathematics engines.  Instructors would be able to mix STACK and WeBWorK questions in the same quiz in such a way that it was invisible (or nearly invisible) to students which engine was handling the question.

Your comments are welcome.

-- Mike Gage, University of Rochester, Rochester, NY

2 comments:

  1. An error message that might occur:

    "The question engine was not able to return the maximum grades for this question. Are you sure the remote id and version are correct? (Technical information: SOAPAction shall match 'uri#method' if present (got 'none', expected 'http://devel3.webwork.rochester.edu/OpaqueServer#getQuestionMetadata')"


    Here is the fix:

    There is a minor bug (feature?) in the opaque question type.

    You will need to make a change around line 174 in the file question/type/opaque/connection.php.



    The only change that I have made in the moodle-qtype_opaque repos code is in connection.php where I have commented out line 174.


    To use the opaque client with WeBWorK you need to comment out the line 174
    in connection.php
    ```
    if ($action) {
    $headers[] = 'SOAPAction: ' . $action;
    } else {
    //$headers[] = 'SOAPAction: none'; // Seemingly, this is necessary.
    }
    ```

    I don’t know why but commenting out this line is necessary to prevent the SOAP Lite implementation of SOAP from complaining.

    ReplyDelete