Math4Team/RIT/Projects/Question Support API/API Design

From Sugar Labs
< Math4Team‎ | RIT‎ | Projects‎ | Question Support API
Revision as of 14:17, 17 April 2009 by Enimihil (talk | contribs) (Add description of the proposed API.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Proposed API

The Quiz API would be a python library, to act mostly as glue between various file formats (and local or remote resources) for question data and the client Activity.

quizdata.open(uri, [cache=False])
Opens a URI, returning a list of quizdata.Question instances. A standard method of filtering question data based on parameters should be specified. Examples of URIs that might be used:
           http://xs-server/math4class/current_topic?format=gift
           file:///var/lib/mathquestions/quiz1?format=moodlexml
           xmpp://teacheraccount@xs.server/classname?format=gift&difficulty=hard&level=4
The cache parameter would locally save the retrieved questions to a persistent storage so requests from the same URI (with cache=True) would read from the cache.
class quizdata.Question
This class contains individual data for a question:
The question text
The style of answer (incl. multiple-choice, numeric, free response, etc.)
The correct answer (or if the question is subjective, that there *is* no correct answer). This includes answers for which the student may receive partial credit.
Question difficulty
Grade level
Tags (for free-form grouping by topic, course, instructor, etc.)
The question text and answers should support at least minimal markup, like that supported by pango, in addition to markup rendering with MathML/LaTeX syntax. (This requires a markup_type parameter of some kind.)
The attributes listed above will should grow standardized names and be documented as part of the interface to the Question class.
Question.answered
Returns True if the student has provided an answer for the Question.
Question.submitted
Returns True if the student has submitted an answer for the Question. XXX: Useful to make a distinction between answered and submitted?
Question.correct
Returns True if the currently selected answer is correct for the Question. XXX: What to do about partial credit? Value between 0 and 1?
Question.answer
Returns the answer the student has currently selected, or None if no answer has been entered.

Implementation Issues

The URI lookup and question filtering based on parameters will be necessary. Further design and discussion is required.

Parsing the various format parsers necessary to build the Question objects.

For markup support, some simple way to give the client activities and easy way to display it would be desirable. (Restrict the list of markup formats? Require supplying plain text in addition?)