fysikteknologsektionen / chalmers-course-stats

Course results and exam statistics at Chalmers University of Technology
https://ftek.se/stats/
MIT License
14 stars 3 forks source link

Chalmers Course Statistics

This is a simple web app for viewing grade statistics of courses at Chalmers University of Technology.

The data is provided by Chalmers via a Excel document obtained by email which lists all the results of all courses.

This app also provides a public REST API.

Installation

Requirements

Setup

Note that these instructions are specific for ftek.se.

To install run these commands:

cd /srv/stats
git clone https://github.com/Fysikteknologsektionen/chalmers-course-stats/ .
npm install
npm run build

To have the app always running you will now create two systemd services:

This can be done by using this configuration for mongod and following this guide for node. Some tweaks might be neccesary to get it working for this specific app. For example the node service should start node server.js in our case.

NOTE The data is currently obtained by manual email as Chalmers does not publish it as a online document anymore.

Software updates

Updates are handled automatically on ftek.se by a PHP script that runs upon a push event via GitHub Webhooks.

However if you want to manually update run these commands:

cd /srv/stats
git fetch
git reset --hard FETCH_HEAD
chown www-data:www-data -R *
npm install
npm run build
sudo /bin/systemctl restart node-course-statistics

A webhook script has been setup so deployment should happen upon a GitHub push event.

Database updates

The database is updated manually by running the following commands after placing the relevant excel document of results in the statistics/documents folder and editing statistics/result_files.json to match:

npm run db

Optionally you can clear the database of old content first by running

npm run db -- --drop
npm run db

Below are the old way of importing things. You should not need to use them.

cd /srv/stats/statistics/
mongo --eval "db.dropDatabase();"
node addFields.js

Development

Contributions, bug reports and suggestions

If you would like to contribute or send feedback, please create an issue first.

Set up development environment

Run these commands:

cd /path/to/development/directory
git clone https://github.com/Fysikteknologsektionen/chalmers-course-stats/
npm install

To start the server run (in separate terminals)

If you find yourself with some error after running node server.js running npm run build before might fix it.

and then point your browser to localhost:3000/stats/. Any updates to any file will automatically refresh the browser.

Credits

This app was created by Jan Liu who was inspired by Johan Bowald's exam statistics page. With the help of Johan Winther the app was ported over to Fysikteknologsektionen's website (ftek.se/stats).

This project was bootstrapped with Create React App. You can find a guide on how to setup and use React here.