Project Report

for Kharagpur Winter of Code (KWoC) 2020

Rajas Bhatt
4 min readJan 3, 2021

Project

IQPS (Intelligent Question Paper Search)

Mentor

Shubham Mishra

Description of the Project

Intelligent Question Paper Search (IQPS) is a project which aims to provide necessary upgrades to the existing website https://qp.metakgp.org/ which is a repository for previous year question papers of IIT Kharagpur, using a fully functional web-app.

GitHub Repository

About KWoC

Kharagpur Winter of Code (aka KWoC) is a five week long online open source development program for students. It aims to provide exposure in the world of open source, and at the same time also helps to prepare for summer training programs like Google Summer of Code.

My Experience

This project offered me my first walkthrough of how open source actually works. Even though I was able to contribute only to one project and have only one meaningful contribution, it still was the best hands-on occasion for learning how to develop something meaningful.

Contribution

My first and only pull request

Added pause-resume functionality in the install.sh file

This pull request was created after writing code to solve the following issue

Issue Description

The installation of the web app is done using docker containers. It involves making a clone of the git repository and then running the install.sh file which basically is a bash script for installing the docker app. This requires a lot of information to be entered by the user (to update the docker-compose.yml file) and if the app is interrupted, the information has to be entered again.

Work

After discussing with the mentor about the possible solutions to this, I decided to implement the pause-resume functionality in the following way: As the user enters their data, I simultaneously store it in a hidden .variable.txt file in the same directory. If the process is completed and the docker app started, the hidden text file is deleted. If the process is not completed and the terminal is aborted while entering data, the script asks the user whether to use the existing backup or start afresh the next time they run install.sh.

Even if one input is given, it is stored in the .variable.txt file. The script automatically detects the number of lines occupied in the .variable.txt file and if the user decides to use the backup version, it starts from the first entry not made by the user in the last attempt.

Instead of hard-coding the questions being asked to the user, I stored them in an array to ensure that we can use a single iterator.

I also improved the UI of the install.sh script thus making it more human readable.

array (the data displayed if the user uses the backup) and the arrayques (the questions to be asked) are two arrays. The hidden text file and the hidden file checker can be seen as well.

The basic UI (lines 92–94) that I added as well as the code for getting hold of the backup .variable.txt file and asking the user whether to use the already available backup is shown below.

If they don’t want to use it, I delete the backup file (line 106).

It can be seen that I check if my counter variable $iis less than the number of lines in the file $lines_in_file and if that is true, I echo the backup data in front of the field/question as well by picking up the line with index i from the .variable.txt file, otherwise fresh input is taken and stored in the hidden file side by side (line 122).

The variables are updated side by side in their respective paths as well. The counter variable is incremented after every checkpoint. This continues for all the items in the array.

A fresh line of dashes (line 126) is also inserted after every field to make the installation variables look less cluttered.

In the end, the .variable.txt file is removed and the docker container is built.

The hidden file is deleted after all the information is taken

Conclusion

The pull request was merged and the code was accepted, as a result the installation process became smoother, even though the number of lines increased. The backup facility protects against repeated data entries if there is an unexpected crash.

Gratitude

I want to thank my mentor Shubham for the amazing support he gave me throughout the program, especially when I was unable to understand some complex git terminology. I also thank KOSS, IITKGP for conducting this program which not only is a good introduction to the world of open source but also allows people and especially newcomers to contribute to meaningful projects used for the greater benefit of the society.

— Rajas Bhatt

--

--