Introduction

Stepic is an educational engine, focused on interactive problems (quizzes).

Please note, that this documentation is a bit obsolete – Stepic Plugins become standalone service in Feb 2015. We’ll update this docs in Feb-March 2015.

Quiz is an interactive component, which can present task to the user, gather user’s solution, evaluate it and present the result back to the user.

Common types of quizzes are choice quizzes, which ask user to select one or more options, Code quizzes, which involve writing some code or math quizzes, which check formulas.

It is possible to extend Stepic engine with custom quizzes via plugins. Here you can find a general overview of what does it takes to create a Stepic plugin.

Quiz Architecture

Quiz is an editable and interactive component, so it must support two operations
  • Quiz creation and editing (by the lesson author)
  • Presentation of the dataset and gathering of the response(of the lesson student)

Quiz consists of two parts, a backend, written in python and executing on the server, and a frontend, written in javascript and executing in browser.

Frontend and backend communicate with each other via fixed protocol and custom messages, representing subset of JSON.

Files for quiz named foo are stored in the directory quizzes/foo.

The directory contents is like this:

quizzes/foo
    __init__.py
    tests.py
    show.hbs
    show.js
    edit.hbs
    edit.js

Backend Overview

To implement a quiz backend, define a base.BaseQuiz subclass in quizzes/foo/__init__.py.

The responsibilities of a backend:
  • specification of the message format to communicate with frontend
  • creation of a quiz instance from quiz source
  • creation of datasets
  • evaluation of submissions

Frontend Overview

To implement a quiz frontend, you need to write handlebars templates and javascript functions for editing the quiz and presenting it to user.

The responsibilities of a frontend:
  • display edit interface, which allow author to edit quiz source(edit.js, edit.hbs).
  • display view interface, which allow student to view dataset and create a submission(show.js, show.hbs).

Frontend/Backend Communication Overview

Frontend and backend communicate via messages JSON. There ara three types of this messages:
  • source represents all the quiz data. Sources are generated via edit interface.
  • dataset is send to a student, when he attempts a quiz. Datasets are generated by backend.
  • reply is send from students browser to backend. Replies are created by view interface.
A typical interaction looks like this:
  • Edit part:
    • an author opens edit interface and creates a new slide with a quiz.
    • the quiz source is send to the backend, where it is validated and, if it is valid, it is persisted.
    • a quiz instance is created from the source and several datasets are generated.
  • View part:
    • a student opens a slide with a quiz and pushes start quiz button.
    • dataset generated during previous part is send to the student’s browser.
    • view interface presents the dataset to the student.
    • the student interacts with the quiz and creates a submission.
    • the student pushes the submit button and the submission is send to the server.
    • a quiz instance is created from source afresh.
    • the instance evaluates the submission
    • the student sees the result