This document provides general information and notes for developers for each supported operating system.
For development on Linux, we recommend using the development container image provided in the deployment/development/src directory in combination with Visual Studio Code and the Dev Containers extension.
The container provides all required development dependencies, including an R installation, Python and Node.js.
You can build and run the development container using Podman and the bash scripts in the deployment/development/bin directory:
build.sh- build the container imageup.sh- starts the container in background modeshell_server.sh- starts an interactive shell inside the containerdown.sh- stops the container
Inside the container, you can use various build scripts from the bin directory to start developing:
build.sh- build the webapp in production modeclean.sh- remove all runtime files (cache, dependencies, etc.)install.sh- install software dependencies (python packages, node modules)lint.sh- check source code stylepackage-electron.sh- package electron app for Linux as AppImage (without R)test.sh- run unit testsrun-webapp.sh- run webapp in production modewatch-webapp.sh- run webapp in development and watch for files changes
On Linux, there is no self-contained pre-built version of R that can be packaged alongside an electron app. Because of that, the easiest way to distribute the application is with a Docker image.
For development on Linux, we recommend installing Python and Node.js manually.
Afterward, you can use various batch scripts from the bin directory to start developing:
build.bat- build the webapp in production modeclean.bat- remove all runtime files (cache, dependencies, etc.)install.bat- install software dependencies (R, python packages, node modules)lint.bat- check source code stylepackage-electron.bat- package electron app for Windows as setup executablerun-webapp.bat- run webapp in production modewatch-webapp.bat- run webapp in development and watch for files changes
On Windows, it is possible to distribute a pre-built version of R alongside the electron app. The install.bat batch file will download R and run the setup wizard in silent mode to install R in the directory code/backend/resources/R. All files of the R installation seem to run independently and do not require any further setup or configuration. When packaging the electron app, the R directory is simply copied. When the electron app is installed on by a user, the R directory is simply extracted and ready to go. The exact path to the Rscript.exe is determined in a custom Python hook, see code/backend/decision_backend/packaging/win_env_hook.py.
For development on MacOS, we suggest installing Podman and following the Linux development recommendations.
On MacOS, there is no self-contained pre-built version of R that can be packaged alongside an electron app. Because of that, the easiest way to distribute the application is with a Docker image.
The following environment variables will be considered when running the backend:
DSUI_DATABASE_PATH=./data/decision-support-ui-backend.db
path to the sqlite database fileDSUI_R_SCRIPT_PATH=Rscript
path to theRscriptorRscript.exebinaryDSUI_JWT_LIFETIME=600
lifetime of the JSON Web Tokens (JWT) in seconds (default is 10 minutes)DSUI_LOG_LEVEL=INFO
log level, show debug messages by providingDEBUGDSUI_R_MAX_RUNTIME=30
maximum runtime of R script in seconds (default 30 seconds)DSUI_R_MAX_MCRUNS=100000
maximum number of Monte Carlo runs that are allowed to run in the backend (default 100.000)DSUI_R_MAX_BINS=200
maximum number of histogram bins that can be generated in the backend (default 200)DSUI_R_VALUE_PRECISION=5
maximum floating point precision when writing numeric values in the R-codeDSUI_CORS_ORIGINS=*
backend CORS origins parameter, adapt according to your deployment strategyDSUI_CORS_METHODS=GET,POST
backend CORS methods parameterDSUI_CORS_HEADERS=*
backend CORS headers parameter, adapt according to your deployment strategy