Skip to content

Analytics

cjshawMIT edited this page Jul 7, 2017 · 2 revisions

Taking assessments

Taking assessments is handled by the player portion of open assessments. Depending on how you configure that tool (via the file client/html/layouts/partials/_head.html), you can inject a student ID for every user. Typically we set a client-side cookie and grab that value. You can follow our code as an example:

function getCookie(cname) {
    var name = cname + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
            var c = ca[i];
            while (c.charAt(0) == ' ') c = c.substring(1);
            if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
    }
    return "";
  }
  window.DEFAULT_SETTINGS = {
    user_id      : 0,
    max_attempts : 1,
    eid          : getCookie('userId'),
    ...
    ...

If a student clicks the "Finish" button at the end of the assessment, the next time they attempt the assessment they will get a new AssessmentTaken record -- so there could be multiple entries for the same student. However, if they do not click "Finish", then they will just continue submitting responses to the same AssessmentTaken.

Technical details of storing student IDs

When students take assessments with qbank using the following URL endpoints, what the player does is set a custom header, x-api-proxy with the username or student ID associated with the user.

  • POST /api/v1/assessment/banks/:bankId/assessmentsoffered/:offeredId/assessmentstaken
  • GET /api/v1/assessment/banks/:bankId/assessmentstaken/:takenId/questions
  • POST /api/v1/assessment/banks/:bankId/assessmentstaken/:takenId/questions/:questionId/submit

This gets passed on to qbank and set in the takingAgentId attribute of the AssessmentTaken. When this is set, it is wrapped in some additional OSID data, so the output looks a little different. If you pass in fred_123 as the x-api-proxy, then the takingAgentId field will read osid.agent.Agent%3Afred_123%40MIT-ODL.

Parsing and understanding results

You can grab results for an AssessmentOffered in bulk or by a specific username.

Results in bulk

GET /api/v1/assessment/banks/:bankId/assessmentsoffered/:offeredId/results

Example output is provided in this gist. You can see the actual question the student saw (including the order of their randomized choices), if they responded, their response if one exists, a timestamp of response, and the correct-ness of the response. The response shown in this view is the most recent one for each question.

You can also include an optional flag additionalAttempts=true to see a list of all previous attempts each student made, for each question.

Results by username

GET /api/v1/assessment/banks/:bankId/assessmentsoffered/:offeredId/results?agentId=<username>

Gives similar output to the above, except it's for a single username, so some of the fields (like takingAgentId) are missing from the output.