Skip to content

NethumL/roster-scheduler

Repository files navigation

Constraint Based Roster Scheduler

Tests

A mobile-optimized web application to generate duty rosters for wards in a hospital.

Usage

  • Clone the repository
git clone https://github.com/NethumL/roster-scheduler
cd roster-scheduler
  • Install Node.js

  • Install the required dependencies

npm install
  • Set up a MongoDB server to use as a database
  • Create a .env.local file with the required environment variables (see environment variables section)
  • Run the webapp
npm run dev

Building for production

npm run build

Deploying

  • The Next.js app can be deployed on Vercel directly as shown in the documentation
  • Set the required environment variables on Vercel
  • Make sure to set up a MongoDB server and set the corresponding MONGODB_URI environment variable
  • Set up the roster generation service and deploy on a server (eg: render)

Testing

  • Create a .env.test.local file with the required environment variables (see environment variables section)
    • Additionally, set the CI environment variable to 1 before running the tests
    • Make sure to use a different database name in .env.test.local

UI tests

  • Build the webapp for production
npm run build
  • Start the webapp for testing
NODE_ENV=test npm run start
  • Separately, run the tests
NODE_ENV=test npx playwright test --workers 1

Unit tests

npm run test:unit

Load testing

pip install locust
  • Start Locust
locust -f tests/load
  • Open the Locust web interface (link will be in the output of the previous command)
  • Configure the testing parameters and the host
  • Run the test

Environment variables

NEXT_PUBLIC_TITLE

  • Title for web application
  • Will be shown in navbar and page title

MONGODB_URI

  • URI for MongoDB server, eg: mongodb://admin:password@127.0.0.1:27017/cs3202?directConnection=true&authSource=admin
  • Make sure the database name is in the URI itself

TOKEN_SECRET

  • Needs to be a sufficiently long random string, eg: DSAVDF+BTMgoBszC9zUJwHx1/s4Gc2ebz9oG1VjrBB8=
  • Can use the OpenSSL command line tool to generate one
$ openssl rand -base64 32
DSAVDF+BTMgoBszC9zUJwHx1/s4Gc2ebz9oG1VjrBB8=

SERVICE_HOST

SERVICE_SECRET

  • Shared secret between this webapp and the service
  • Needs to be a sufficiently long random string, eg: DSAVDF+BTMgoBszC9zUJwHx1/s4Gc2ebz9oG1VjrBB8=
  • Can use the OpenSSL command line tool to generate one (similar to TOKEN_SECRET)

Team

  • 190332D Sasitha Kumarasinghe
  • 190334K H. R. S. Kumari
  • 190349K Nethum Lamahewage

About

Constraint Based Roster Scheduler for CS3202

Resources

Stars

Watchers

Forks

Languages