jupyter/nbgrader — pull request #25 by jhamrick (2014-10-30 05:31:03+00:00)
Title: Save grades in a mongodb

This is still kind of a work in progress, but I thought I'd make a PR to show what I have so far after discussing today with @ellisonbg and @minrk . We talked about the following things:

- [x] reconfigure the database tables to be somewhat more relational
- [x] write an API around access to the database
- [ ] remove the `formgrade` postprocessor and make the server a separate thing (I haven't done this yet, though in the time being I made it so at least it will process all the notebooks before running the postprocessor).
- [x] add prompts to the `Score` and `Comment` fields

So, the way that this actually works is:

1. You have to separately add in students to the database. If you try to grade an assignment for a student that doesn't exist, it will throw an error. You can do it like this:

```python
from nbgrader.api import Gradebook, Student
s1 = Student(student_id="Bitdiddle", first_name="Ben", last_name="Bitdiddle")
s2 = Student(student_id="Hacker", first_name="Alyssa", last_name="Hacker")
gb = Gradebook()
gb.add_student(s1)
gb.add_student(s2)
```

2. Then, you can run `nbgrader autograde` on their assignments. This will store the autograder scores into the database.

3. Then, you can run `nbgrader formgrade`, which will convert the graded notebooks to HTML, and then launch a Flask app to view and modify the grades. The dashboard/notebook list page currently looks like this:

![image](https://cloud.githubusercontent.com/assets/83444/4838923/0538ec68-5ff5-11e4-8e51-f19392cd6f46.png)

The score is the sum of all the individual problems/parts within the notebook. "Needs manual grade" means there was a part that couldn't be autograded -- for example, a written answer -- and which hasn't been graded by hand yet. The notebook view looks like this:

![image](https://cloud.githubusercontent.com/assets/83444/4838928/20f77b0e-5ff5-11e4-926d-9adcb58ddaf3.png)

The prev/next buttons will take you to the next notebook in the list, and the home button will go back to the whole notebook list. Currently this assumes that the HTML files produced by `nbgrader formgrade` are all in one directory, and have a very particular naming scheme (".autograded.html"). These are probably not good assumptions to make, but I think require a little more thought.