OpenQP can manage a question bank containing multiple courses and generate Question Papers, based on some pre-defined algorithm. The questions are stored in LaTex format in a postgres RDBMS system, connected to the Internet.
The postgres system should be configured for TCP/IP login. Using the postgres administrator account
A program named initQbank.py is used for creating:
These Python programs require PyQt5 and LaTex software.
To create a course, a unique Course Code must be specified. The other details are shown in the screenshot.
Entries except the Course code and Course name can be selected from the pulled down menus, and edited if required. You can connect to a Question bank database and list the courses on it. - Existing courses may be deleted by selecting them from the menu. Doing so removes it along with the contents.
This program
The table, role and course names are the same. The ‘role’ name is converted into lowercase letters.
A project Directory should be created once. The subdirectories for storing the Courses will be created by the program when you import a new course. The procedure to be followed:
Fill all the sections (P1 to P8). Verify it and export to the Database. The editing can be done only locally. To modify an existing Course;
A screenshot of the program is shown below.
This is done from a Browser. A web server runs on the same machine where the Database is running. The programs kept in the web root directory are;
The ‘index.php’ collects some details in a Form and calls ‘qgen.php’. This in turn calls ‘txtQgen.py’ to generate two LaTex files; Question paper and Answer Paper.
‘qgen.php’ calls ‘xelatex’ to compile the .tex file and a link to the generated PDF output is presented. Try it from the link below.
# Setting up OpenQP using nginx, postgresql and php on a newly installed Ubuntu 20.04
# All commands are issued as root user, working directory is /root
apt update
apt install joe nginx certbot python3-certbot-nginx postgresql php-common php-fpm php-pgsql python3-numpy texlive-xetex fonts-smc-rachana fonts-lohit-deva
ufw default deny incoming;
ufw default allow outgoing;
ufw allow OpenSSH;
ufw allow 'Nginx Full';
ufw allow 5432/tcp
ufw enable;
# Nginx configuration files
joe /etc/nginx/sites-available/default
# This is the content of a working configuration file.
server {
listen 80;
listen [::]:80;
root /var/www/html;
index index.php index.html index.htm;
server_name openqp.scischool.in;
# for PHP7.4 access
location ~[^/]\.php(/|$) {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_read_timeout 600;
}
}
-------------------------
copy the following files to /var/www/html
index.php
qgen.php
txtQgen.py
chown www-data:www-data /var/www/html # write permission for web server
systemctl restart nginx
certbot --nginx -d openqp.scischool.in # get the TLS certificate
Postgres configuration
# Set the postgres HBA configuration to allow a connection using IP protocol
/etc/postgresql/12/main/pg_hba.conf should have the following lines
local all all password
host all all 127.0.0.1/32 password
host all all 0.0.0.0/0 password
Modify /etc/postgresql/12/main/postgresql.conf , to have the line
listen_addresses = '*' # what IP address(es) to listen on;
systemctl restart postgresql
# Become the postgres user to create the moodle database and user.
sudo -su postgres
$ psql # replace QB with the database name
postgres=# create role QB with createrole login password '******';
postgres=# create database QB;
postgres=# grant all on database QB to QB;
postgres=# create user dummy with password 'dum123';
postgres=# \q
Now run initQbank.py to make the coursedetails table.
Qadmin should work NOW.
Create a new course with all details
Run Qeditor.py
Create a project directory
Select the newly created remote course and import it.
Fill the folders P1 to P8 with questions
Verify and Export the course