CSC/ECE 517 Fall 2019 - E1991. Improvements to anonymized view

From Expertiza_Wiki
Jump to navigation Jump to search

Introduction

The Expertiza project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors to submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.


Problem Statement

The main idea of this project is to improve anonymized view in Expertiza. The feature is already implemented. However, there are issues / limitations with the current implementation which we will try to improve as a part of this project.

Anonymized View For Students

Currently, anonymized view is not implemented for students. Although, not directly required by students, instructors may want to use anonymized view when impersonating a student.

Issue with Impersonating Anonymized Student

In an anonymized view, instructors cannot impersonate a student because the username field has the anonymized name instead of their real name in the database. In order to be able to impersonate a student, we need to know their real names from database.

Wrong Anonymized Names

In some places, anonymized names are not shown. For example, heatgrid view.

Anonymizing Team Names

Currently, team names are not anonymized.

Optional Objective

Use randomized American names for anonymized users.

Proposed Solution

In this section, we propose solutions to the problems / issues discussed above.

Anonymized View For Students

Instructors often use 'impersonate' functionality to use Expertiza as a different user. Sometimes they also need to use anonymized view while they are impersonating a student. Therefore, anonymized view needs to be extended to students as well.

In order to extend Anonymized view for students, the first thing we need to do is extend the following function :

 def set_anonymized_view
   anonymized_view_starter_ips = $redis.get('anonymized_view_starter_ips') || 
   session[:ip] = request.remote_ip
   if anonymized_view_starter_ips.include? session[:ip]
     anonymized_view_starter_ips.delete!(" #{session[:ip]}")
   else
     anonymized_view_starter_ips += " #{session[:ip]}"
   end
   $redis.set('anonymized_view_starter_ips', anonymized_view_starter_ips)
   redirect_to :back
 end

This function is responsible to switch back and forth between normal view and an anonymized view. We could figure out that the session of current user is being manipulated to change views. The main driving logic works by storing user's IP address in a value field of anonymized_view_starter_ips which is in Redis database.

Refer the following flow chart for design details:

Impersonating Student Using Anonymized Names

When an instructor is already in Anonymized view and wants to impersonate a student, they have to quit the anonymized view and get the real username of that student. However, we want the instructor to be able to impersonate a student by using their anonymized names. The following function in impersonate_controller.rb is responsible to impersonate students.

 def impersonate
   ...
   begin
     original_user = session[:super_user] || session[:user]
     # Impersonate using form on /impersonate/start
     if params[:impersonate].nil?
       ...
       user = User.find_by(name: params[:user][:name]) 
       ...
     else
       # Impersonate a new account
       if !params[:impersonate][:name].empty?
         ...
         user = User.find_by(name: params[:impersonate][:name])          
         ...
       else
         ...
       end
     end
     ...
   rescue Exception => e
     flash[:error] = e.message
     redirect_to :back
   end
 end

In the above snippet, we have omitted the irrelevant parts of code. The only change we need to do is the logic for User.find_by() function. We will add a condition to check whether the current view is anonymized or not. If anonymized mode is set, we will convert the anonymous name back to the original name of the student. We will then make 'find' query using the real name of the student instead of using their anonymized name.

The procedure to do this would be opposite of what we do to get anonymized names in first place. See following code snippet :

 def name(ip_address = nil)
   User.anonymized_view?(ip_address) ? self.role.name + ' ' + self.id.to_s : self[:name]
 end

The above snippet is an example of how anonymized names are generated.

Anonymizing Team Names

Right now, team names are not anonymized. We need to add accessor methods for team names in team.rb model file.

Additionally, we need a before function to check whether Anonymized view is set or not. In this function, we will generate anonymized name whenever Anonymized view is set. This is very similar to existing implementation of anonymizing user names as shown below :

 def self.anonymized_view?(ip_address = nil)
   anonymized_view_starter_ips = $redis.get('anonymized_view_starter_ips') || 
   return true if ip_address and anonymized_view_starter_ips.include? ip_address
   false
 end
 ...
 def fullname(ip_address = nil)
   User.anonymized_view?(ip_address) ? self.role.name + ', ' + self.id.to_s : self[:fullname]
 end

Wrong Anonymized Names

In some parts of the application, anonymized names are not working properly right now. It is highly difficult to find all such occurrences in the application at this early stage of the project. We are working to find all such occurrences.

However, we figured out that we need a common helper function to determine the name of a student based on whether Anonymized view is set or not. We will use the same function whenever we need to display name of a student. The function will internally take care of checking whether to return anonymized name or the real name.

User Flowchart/Design

Test Plan

In this section, we discuss what the expected output of all the features will be in terms of well defined test steps.

Anonymized View For Students

  1. Login as an instructor
  2. Impersonate a student
  3. Switch to Anonymized view as a student

Right now, (3) is not supported.

Impersonating Student Using Anonymized Names

  1. Login as an instructor
  2. Switch to Anonymized view
  3. Find a student from list of users
  4. Assert that the student name is anonymized
  5. Use the anonymized name to impersonate the real user behind anonymous entity

Currently, (5) is not supported

Anonymizing Team Names

  1. Login as an instructor
  2. Switch to Anonymized view
  3. All team names should now be anonymized

In current implementation, (3) is not supported

Wrong Anonymized Names

We are yet to triage the scope of this functionality.

American English Names for Anonymized Students

  1. Login as an instructor
  2. Switch to Anonymized view
  3. Anonymized student names should be normal human names in American English, instead of cryptic names like student12312

Team Information

  1. Shubham Dilip Pampattiwar (sdpampat)
  2. Pranav Maruti Gaikwad (pmgaikwa)
  3. Omkar Sunil Kulkarni (oskulkar)
  4. Deepayan Bardhan (dbardha)

Mentor: Sharique Khan (mkhan8)
Professor: Dr. Edward F. Gehringer (efg)

References

  1. Expertiza on GitHub