DIZtools

CRAN Status Badge Cran Checks Dependencies R CMD Check via {tic} linting test-coverage codecov

The R package DIZtools provides utility functions used for the R package development infrastructure inside the data integration centers (‘DIZ’) to standardize and facilitate repetitive tasks such as setting up a database connection or issuing notification messages and to avoid redundancy.

:bulb: DIZtools contains all “lightweighted” functions of DIZutils making it a lot quicker to install, while DIZutils has a lot of dependencies and system requirements.

Installation

You can install DIZtools directly from CRAN:

install.packages("DIZtools")

The development version can be installed using

install.packages("remotes")
remotes::install_github("miracum/misc-diztools", ref = "dev")

setenv_file

In order to set up a database connection using the function DIZutils::db_connection, one needs to provide the required connection settings via environment variables. To facilitate the process of making such environment variables available within the current R session, the function DIZtools::setenv_file works as a wrapper function around the base R method Sys.setenv. It takes the file name of a text file with the definitions of the environment variables as input, and sets those environment variables within the current R session.

DIZtools::setenv_file("path/to/envfile")

The design of the envfile is based on the .env file for defining environment variables when using docker-compose commands. See here (currently, neither empty lines nor the using of comments (‘#’) is being supported by DIZtools::setenv_file).

To create an envfile for connecting with an i2b2 database, the following exemplary definitions of environment variables should be written to a simple textfile, e.g. named envfile, which can then be passed as argument to DIZtools::setenv_file.

I2B2_HOST=123.45.56.8
I2B2_PORT=5432
I2B2_DBNAME=i2b2
I2B2_USER=user
I2B2_PASSWORD=password

More Infos