Distributing grade details in the online semester

Nilava Metya

April, 2021

When this online circus started, I was given my scores and grades, but there was this lack of information. I could not "see" my graded script. Things improved slowly. For some courses, I got the scores for individual questions, and for some, I got the letter grade directly which was really frustrating (even if it was an A - the highest possible grade).

It is understandable that people not very familiar with technology are familiarizing themselves. What is not understandable is that people not familiar with technology don't reject the suggestion of others who are familiar with the technology. Whatever I am going to pen down in this article, I already had this idea (not a concrete implementation) a year ago. But I did not find an appropriate place to implement this (except to suggest to people who were not open to suggestions), until I got the opportunity to be a teaching assistant (I graded scripts there) in one of the courses.

I even asked the authorities to develop a mechanism to make it easy for graders to distribute scores among students, without copying individual scores from the excel sheet to some online database, or mailing students one by one manually. I was told that there are some difficulties.

When I got the chance to be a TA for the (UG) Algebra I course at CMI, I decided to be the change I wanted to see. And looked up the internet myself, to find something which suited the job. It did take me a while to figure out stuff, because I was not very learned either. But I figured out something in the end. Of course, there are problems with this method (including security issues) and there are ways to improve this. But my aim is to bridge the gap between graders and students, to ensure that technology does to cost a student their right to information. I'm sure this article (implementation of the idea) will certainly give produce some nonzero momentum which will keep growing in the future.

Whatever is mentioned in this article is written specifically for CMI. I shall be using my gmail account to share data with students, and python to write a script which will automate the process for me. There are (I can ensure that) analogous methods for institutes which are not CMI, and for non-google accounts. In CMI, moodle is the online service used for the management of courses. User details (roll number, email id) can be downloaded from there (in .csv format).

You will ofcourse first need a table or database or datasheet which will contain the marks and comments and other data which we want to distribute to the students.
I use Google Sheets for this. It has all the basic features one needs for maintaining data and also allows multiple Google users to collaborate (edit and view).

Fun fact: People can use Google Sheets or Microsoft Excel for functional programming. Check out the video here.

The sheet(s) must contain the data about details of the student. For example, I had the first three columns of my sheets as Name, Roll number and CMI userid. An example of entries under these columns could be Nilava Metya, BMC201930 and nilavam@cmi.ac.in, respectively.
The other columns would contain data about each individual student. For example, I used to label them as s1, c1, s2, c2, and so on. These are abbreviations for score 1, comment 1, score 2, and so on. There was a TOTAL column at the end, which kept track of the total score of the students. You need not calculate the scores manually. Just enter the formula =SUM(cells_to_sum__separated_by_commas).

In case of a large database, you might want to do some conditional formatting, so that you can "look" for something easily. For example, I wanted that I would spot the ungraded scripts (I used to grade a few scripts everyday). So what I did was the following:

Make sure Python 3 or higher is installed on your machine. You must be able to use it from the terminal (basic task like running a .py file). The command I would use to execute a file named file.py is python3 file.py (assuming my terminal is open in the same directory as my file). Some machines will directly recognize python instead of python3. If you want to check which verstion of python the command is linked to, try executing python --version. Here is an example from my terminal:

nm@Nilavas-MacBook-Air ~ % python3 --version
Python 3.9.1
nm@Nilavas-MacBook-Air ~ % python --version 
Python 2.7.16

Now comes the risky part. This will compromise the security of your gmail account because you will be using python to login to your google account which gmail will block by default. But you can manually tackle this. Do this if you trust the python code I will provide (go through the code and ensure that there is no security threat to your email). Or you can simply create a new gmail account which if compromised causes no loss. Follow these steps to ready your gmail account for sending individual details.

  1. Ensure that 2-factor authentication is not enabled. If it is enabled, disable it manually (but please enable it after the process of sending individual details).
  2. Go to this link and make sure that Allow less secure apps is turned ON. Please turn it OFF after this process.

Once you have your database (with the scores and details of students), Python 3 or later, and your google account ready, you can go ahead and send emails. This works much like mail-merge, except that the free services always keep some restrictions to your freedom (and also compromise the security of your google account, if you are using 3rd party apps). Download the google sheet in .csv format and store it in a directory. Rename the file as contact.csv. Make sure the file name is contact with extension .csv, and not contact.csv with extension .csv.

  1. Download this python file. Please verify that your gmail security is not compromised by usage of this file. Store it in the same directory as contact.csv. Please let me know at nilavam@cmi.ac.in if better comments could be written for the code to be understood well. I am welcome to suggestions.
  2. Make appropriate changes to the file. You will have to put in a message (email body), and the column headings of contact.csv file in order, etc. The texts inside braces inside the email body (mail_content) are parameters which are taken from contact.csv file. These are different for each person, so the details are fetched from the .csv file, put into the body, and mailed.
  3. After you have made appropriate changes, save the file. Now open your terminal and using the cd command, navigate to the directory containing the contact.csv and send_mail.py files are saved.
    Execute python3 send_mail.py. You will be asked to enter your gmail id and password. While entering the password, no characters will be displayed (but they are being read by the machine!).


I used this spreadsheet. The downloaded file is contact.csv. This works well with the code given (I just entered my gmail id and password). Here is what my execution (on terminal) looks like:

nnm@Nilavas-MacBook-Air wwwcmi % python3 send_mail.py 
Your gmail id: nilavametya.huntik@gmail.com
nilava@cmi.ac.in Mail Sent

Here is the text version of the received email.