book_server_api.routers.assessment module

class book_server_api.routers.assessment.ExamRequest(*, div_id: str, course_name: str)

Bases: BaseModel

course_name: str
div_id: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'course_name': FieldInfo(annotation=str, required=True), 'div_id': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class book_server_api.routers.assessment.HistoryRequest(*, acid: str, sid: Optional[str] = None)

Bases: BaseModel

acid: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'acid': FieldInfo(annotation=str, required=True), 'sid': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

sid: Optional[str]
async book_server_api.routers.assessment.get_assessment_results(request_data: AssessmentRequest, request: Request, user=Depends(LoginManager))
async book_server_api.routers.assessment.get_history(request: Request, request_data: HistoryRequest, user=Depends(LoginManager))

return the history of saved code by this user for a particular active code id (acid) – known as div_id elsewhere See addHistoryScrubber

Parameters:
  • See HistoryRequest

Return:
  • json object with a detail key that references a dictionary

{ "acid": div_id,
  "sid" : id of student requested,
  "history": [code, code, code],
  "timestamps": [ts, ts, ts]
}
async book_server_api.routers.assessment.get_question_source(request: Request, request_data: SelectQRequest)

Called from the selectquestion directive There are 4 cases:

  1. If there is only 1 question in the question list then return the html source for it.

  2. If there are multiple questions then choose a question at random

  3. If a proficiency is selected then select a random question that tests that proficiency

  4. If the question is an AB question then see if this student is an A or a B or assign them to one randomly.

In the last two cases, first check to see if there is a question for this student for this component that was previously selected.

Returns:

json: html source for this question

async book_server_api.routers.assessment.getaggregateresults(request: Request, div_id: str, course_name: str)

Provide the data for a summary of the answers for a multiple choice question. What percent of students chose each answer. This is used when the compare me button is pressed by the student.

async book_server_api.routers.assessment.getpollresults(request: Request, course: str, div_id: str)
async book_server_api.routers.assessment.gettop10Answers(request: Request, course: str, div_id: str)
async book_server_api.routers.assessment.htmlsrc(request: Request, acid: str, sid: Optional[str] = None, assignmentId: Optional[int] = None)

Used by Toggle Questions and the grading interface Get the html source for a question. If just the divid is included then assume that the question must come from the current base course. If an assignment_id is provided then that question could come from any base course and so make sure it is part of the current assignment_questions set.

async book_server_api.routers.assessment.set_selected_question(request: Request, metaid: str, selected: str)

This endpoint is used by the selectquestion problems that allow the student to select the problem they work on. For example they may have a programming problem that can be solved with writing code, or they can switch to a parsons problem if necessary.

Called from toggleSet

Caller must provide: * metaid – the id of the selectquestion * selected – the id of the real question chosen by the student

async book_server_api.routers.assessment.tookTimedAssessment(request: Request, request_data: ExamRequest)