Skip to content
HTML/JavaScript GUI for MCDA preference elicitation
JavaScript CSS HTML TeX R Shell Other
Branch: master
Clone or download
Latest commit 3521d4c Oct 30, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R add ranges Sep 3, 2019
app update tests for validating workspace Oct 30, 2019
examples Feature/integration tests (#111) Oct 24, 2019
frontend-test update tests for validating workspace Oct 30, 2019
node-backend
public
sass-shared @ 9f9b5ae don't use arrow functions in front-end Oct 15, 2019
sass Feature/integration tests (#111) Oct 24, 2019
schema allow stdErr on relative entries baseline Oct 30, 2019
test Upgrade dependencies; Fix median/mode end-to-end test Oct 24, 2019
tutorials merge develop; final correction in tutorials Oct 14, 2019
.gitignore refactoring and tests WIP Jul 24, 2019
.gitmodules add submodule Dec 18, 2013
Dockerfile use apt in dockerfile instead of apt-get Sep 12, 2019
LICENSE.txt Add README and LICENSE Nov 27, 2013
Makefile
README.md Feature/integration tests (#111) Oct 24, 2019
add-user.sh update readme, add-user script, add bcrypt-cli to dependencies Oct 22, 2018
build-docker.sh fix error on missing certificate authority file Sep 24, 2019
config.rb
database.pg.sql refactoring and tests WIP Jul 24, 2019
index.js Upgrade dependencies; Fix median/mode end-to-end test Oct 24, 2019
karma.conf.js Feature/integration tests (#111) Oct 24, 2019
nightwatch.conf.js Feature/integration tests (#111) Oct 24, 2019
package.json version bump Oct 30, 2019
run-mcda-docker.sh add scripts for mcda docker Oct 22, 2018
run-worker.sh update tutorials Jan 14, 2019
webpack.common.js Upgrade dependencies; Fix median/mode end-to-end test Oct 24, 2019
webpack.dev.js webpacking wip Aug 27, 2018
webpack.local.js local webpack build production Oct 12, 2018
webpack.prod.js update README; use babel for IE11 Oct 24, 2018
yarn.lock Upgrade dependencies; Fix median/mode end-to-end test Oct 24, 2019

README.md

mcda-elicitation-web

This tool provides a web interface for Multiple Criteria Decision Analysis preference elicitation. Currently, it supports eliciting the following types of preference information:

  • Linear partial value functions
  • Piece-wise linear partial value functions using MACBETH
  • Ranking criteria trade-offs (ordinal SWING)
  • Exact criteria trade-off ratios (exact SWING)
  • Imprecise criteria trade-off ratios (interval SWING)

The tool uses the Patavi web service wrapper for R and the 'hitandrun' and 'smaa' R packages to calculate MCDA results during and after the preference elicitation process.

mcda-elicitation-web is a component of the drugis.org ADDIS 2 project. For more information on all components of the drugis project, please refer to the OVERALL-README.md in the root folder of the ADDIS-CORE project.

Prerequisites for running mcda-web

  • A PostgreSQL instance with an initialised database. You can create one in a docker container by running the setup-db.sh script. Make sure to change the passwords from the default.

If you already have a postgresql database you can use, it can be initialised as follows (change passwords as desired):

CREATE USER mcda WITH PASSWORD 'develop';
CREATE DATABASE mcda ENCODING 'utf-8' OWNER mcda;

Create a .pgpass in the user home to store the database password the file should contain a line with the following format hostname:port:database:username:password, e.g:

localhost:5432:mcda:mcda:develop

Create the schema (shell script)

psql -h localhost -U mcda -d mcda -f database.pg.sql
  • A patavi-server instance along with a rabbitMQ service. see the patavi repository for installation and running instructions.

  • At least one smaa patavi worker, started by executing the run-worker.sh script.

Running as Docker container

Building the image (optional)

You can build a new local image by executing the build-docker.sh script. This would be required for example if you wish to change the default SSL keys. Note that this script assumes that your keys are present in an ssl subdirectory of the main mcda directory. Also note that, if your patavi server presents a certificate that is not trusted by default, there should be a CA certificate for the signing certificate authority of your patavi container in this directory. The default patavi server image presents a certificate signed by the Drugis self-signed certificate authority

The build-docker.sh script also lets you specify the signin method via command line argument. The current options are Google OAuth 2.0 (GOOGLE) and username/password (LOCAL). The default signin method is Google OAuth 2.0.

For local signin, there are several further dependencies (assuming a version of NodeJS of 10.x) to generate the users and passwords:

sudo npm -g install yarn
sudo npm -g install npx
yarn

After installing these dependencies, you can add users for the LOCAL signin method by using the add-user.sh script.

Running the container

Execute the run-mcda-docker.sh script.

If you built the container with a specific login method arugment, you should run the run-mcda-docker.sh script with the same one.

e.g.:

./build-docker.sh LOCAL
./run-mcda-docker.sh LOCAL

Note that you should probably change the default settings in the script (e.g. check whether the link arguments match the names of your containers, and the names of the certificate files match those in your ssl directory if you built your own image). The script also assumes that the sql database and patavi server and worker are already set up and running. The run script runs the addis/mcda image, which will be pulled from docker hub by default. The default image comes with SSL keys which assume localhost or localdocker CNs, and which are signed by our self-signed certificate authority.

Because the default patavi-server image users a certificate signed by our certificate authority you need to add this certificate to the browser's trusted authorities for R results to be displayed.

Running as standalone application

Setting up the database

sudo -u postgres psql -c "CREATE USER mcdaweb WITH PASSWORD 'develop'" sudo -u postgres psql -c "CREATE DATABASE mcdaweb ENCODING 'utf-8' OWNER mcdaweb" psql -d mcdaweb -U mcdaweb -f database.pg.sql

Running

Set environment variables:

export MCDAWEB_DB_USER=mcdaweb
export MCDAWEB_DB_PASSWORD=develop
export MCDAWEB_DB_HOST=localhost
export MCDAWEB_DB_NAME=mcdaweb
export MCDAWEB_GOOGLE_KEY=<something>
export MCDAWEB_GOOGLE_SECRET=<something-else>
export MCDA_COOKIE_SECRET=<some-random-string>
export MCDA_HOST=localhost
export PATAVI_HOST=localhost
export PATAVI_PORT=3000
export PATAVI_CLIENT_KEY=path/to/key
export PATAVI_CLIENT_CRT=/path/to/crt
export PATAVI_CA=/path/to/ca

Getting the dependencies:

yarn

Building the application:

npm run build-prod

Running the application:

node index.js or npm start

Running the patavi worker

As a prerequisite, build the patavi worker image from the patavi repository.

Then, build the worker itself, in the R directory:

docker build --tag patavi/worker-smaa_v2 .

Run the worker:

docker run -d --link <rabbitmq-container-name>:rabbit --name patavi-smaa_v2 patavi/worker-smaa_v2

Development

Tests

Executing tests (front-end unit tests, and back-end unit tests):

npm test

Executing end-to-end tests:

npm run test-end-to-end

Requirements for end-to-end tests:

  • a local login build
  • a test user with credentials user/password
  • a running server (on http://localhost:3002, can be changed in test/endToEnd/util/constants.js'http://localhost:3002')
  • a Firefox browser (tested on 69.0.2)

Building the frontend with inline source maps for faster debugging:

npm run build-dev

Continually rebuilding while you develop:

npm run dev

Building a local login version:

npm run build-local-login

Initialize submodules (only needed for CSS rebuilding)

git submodule init
git submodule update

Compiling the CSS

Using compass (through config.rb):

compass compile

Using node-sass:

node-sass --include-path sass-shared sass/mcda-plain.scss app/css/mcda-plain.css
node-sass --include-path sass-shared sass/mcda-drugis.scss app/css/mcda-drugis.css

License

mcda-elicitation-web is open source, and licensed under GPLv3. See LICENSE.txt for more information.

You can’t perform that action at this time.