Learn R Programming

DataSHIELD Interface

The DataSHIELD Interface (DSI) defines a set of S4 classes and generic methods that can be implemented for accessing a data repository supporting the DataSHIELD infrastructure: controlled R commands to be executed on the server side are garanteeing that non disclosive information is returned to client side.

Learn more about DataSHIELD.

Class Structure

The DSI classes are:

  • DSObject a common base class for all DSI,
  • DSDriver drives the creation of a connection object,
  • DSConnection allows the interaction with the remote server; DataSHIELD operations such as

aggregation and assignment return a result object; DataSHIELD setup status check can be performed (dataset access, configuration comparision),

  • DSResult wraps access to the result, which can be fetched either synchronously or asynchronously

depending on the capabilities of the data repository server.

All classes are virtual: they cannot be instantiated directly and instead must be subclassed. See DSOpal for a reference implementation of DSI based on the Opal data warehouse. See also DSLite for a server-less implementation of DSI for local datasets.

These S4 classes and generic methods are meant to be used for implementing connection to a DataSHIELD-aware data repository.

Higher Level Functions

In addition to these S4 classes, DSI provides functions to handle a list of remote data repository servers:

  • datashield.login and datashield.logout will make use of the DSDriver paradigm to create DSConnections

to the data repositories,

  • datashield.aggregate and datashield.assign will perform typical DataSHIELD operations on DSConnections,

which result will be fetched through DSResult objects,

  • datashield.connections, datashield.connections_default and datashield.connections_find are functions

for managing the list of DSConnection objects that will be discovered and used by the client-side analytic functions.

  • datashield.errors will report the last R errors that may have occurred after a datashield.assign or datashield.aggregate call.
  • Other data management functions are provided by the DSConnection objects:
    • datashield.workspaces, datashield.workspace_save, datashield.workspace_restore and datashield.workspace_rm allow to manage R images
    of the remote DataSHIELD sessions (to speed up data analysis sessions),
    • datashield.symbols and datashield.symbol_rm offer a minimalistic management of the R symbols living in
    the remote DataSHIELD sessions,
    • datashield.tables, datashield.table_status list the tables and their accessibility across a set of data repositories,
    • datashield.resources, datashield.resource_status list the resources and their accessibility across a set of data repositories,
    • datashield.pkg_status, datashield.method_status and datashield.methods are
    utility functions to explore the DataSHIELD setup across a set of data repositories.
    • datashield.profiles lists the DataSHIELD profiles that can be selected at login time.

These datashield.* functions are meant to be used by DataSHIELD packages developers and users.

Options

Some options can be set to modify the behavior of the DSI:

  • datashield.env is the R environment in which the DSConnection object list is to be looking for. Default value is the Global Environment: globalenv().
  • datashield.progress is a logical to enable the visibility of the progress bars. Default value is TRUE.
  • datashield.progress.clear is a logical to make the progress bar disappear after it has been completed. Default value is FALSE.
  • datashield.errors.stop is a logical to alter error handling behavior: if TRUE an error is raised when at least one server has failed, otherwise a warning message is issued. Default value is TRUE.
  • datashield.polling.sleep.0 time in seconds to wait before checking async calls completion, before ~1 second. Default value 50 milliseconds.
  • datashield.polling.sleep.1 base time in seconds to wait before checking async calls completion, after ~1 second. Default value is 1 second.
  • datashield.polling.sleep.10 time in seconds to wait before checking async calls completion, after ~10 seconds. Default value is x2 the base time (2 seconds).
  • datashield.polling.sleep.60 time in seconds to wait before checking async calls completion, after ~1 minute. Default value is x10 the base time (10 seconds).
  • datashield.polling.sleep.600 time in seconds to wait before checking async calls completion, after ~10 minutes. Default value is x60 the base time (1 minute).
  • datashield.polling.sleep.3600 time in seconds to wait before checking async calls completion, after ~1 hour. Default value is x600 the base time (10 minutes).

Copy Link

Version

Install

install.packages('DSI')

Monthly Downloads

724

Version

1.7.0

License

LGPL (>= 2.1)

Issues

Pull Requests

Stars

Forks

Maintainer

Yannick Marcon

Last Published

October 8th, 2024

Functions in DSI (1.7.0)

datashield.rm

Remove a R symbol
datashield.resource_status

Status of some resources
datashield.tables

List of the tables
datashield.table_status

Status of some tables
.clearLastErrors

Clear last errors
.is.callback

Check if a callback parameter is a valid function
.isDSConnection

Check if provided object is a S4 class instance and if this class inherits from DSConnection-class.
datashield.symbols

List R symbols
dsAssignResource

Assign a resource object
datashield.resources

List of the resources
dsFetch

Get the raw result
dsAssignTable

Assign a data table
dsConnect

Create a connection to a DataSHIELD-aware data repository
.appendError

Append error message to last errors vector
.deparse

Deparse language expression
.clearCache

Clear some cache
.getDSConnections

Gets the DSConnection-class objects
.getSleepTime

Get time to sleep depending on the numer of previous iterations
datashield.workspace_restore

Restore saved workspace to the current DataSHIELD R session
dsGetInfo

Get DataSHIELD-aware data repository metadata
.asNamedListOfConnections

Makes a single DSConnection-class object or a named list of DSConnection-class objects.
.hasLastErrors

Check if there are last errors
datashield.connections_find

Search for DSConnection objects in the analytic environment
dsDisconnect

Disconnect (close) a connection
dsIsAsync

Asynchronous result support
.asNamedListOfResources

Makes a typical logindata data frame a list of resources named by the server in which they are defined. Makes a character vector of resource names a list named by the connections.
dsHasTable

Check remote table exists
dsHasResource

Check remote resource exists
.asNamedListOfTables

Makes a typical logindata data frame a list of tables named by the server in which they are defined. Makes a character vector of table names a list named by the connections.
dsAggregate

Aggregate data
dsListWorkspaces

Get the DataSHIELD workspaces
datashield.workspace_rm

Remove a DataSHIELD workspace
.remove_curly_brackets

Remove Curly Brackets from Strings
dsListTables

List remote tables
datashield.workspaces

List saved DataSHIELD R workspaces
dsRestoreWorkspace

Restore a saved DataSHIELD R session (a workspace) into the current DataSHIELD R session
.newProgress

Create a new progress instance with default settings.
dsAssignExpr

Assign an expression result
datashield.workspace_save

Save DataSHIELD R session to a workspace
datashield.pkg_status

Status of the DataSHIELD packages
dsRmSymbol

Remove a symbol
datashield.profiles

List of DataSHIELD profiles
dsListResources

List remote resources
dsSaveWorkspace

Save the DataSHIELD R session in a workspace
dsRmWorkspace

Remove a DataSHIELD workspace
dsListSymbols

List symbols
.asNamedListOfValues

Makes a typical logindata data frame a list of items named by the server in which they are defined. Makes a character vector of item names a list named by the connections.
dsKeepAlive

Keep a connection alive
dsListMethods

Get the DataSHIELD methods
.checkLastErrors

Check if there are last errors
dsListProfiles

Get the DataSHIELD profiles
dsListPackages

Get the DataSHIELD packages
.updateProgress

Update the progress status if option "datashield.progress" is TRUE.
.tickProgress

Update and increment the progress status if option "datashield.progress" is TRUE.
dsIsCompleted

Get whether the operation is completed
newDSLoginBuilder

Create a new DataSHIELD login details builder
datashield.assign.expr

Expression result assignment
DSConnection-class

DSConnection class
DSDriver-class

DSDriver class
datashield.assign.resource

Resource assignment
datashield.aggregate

Data aggregation
DSResult-class

DSResult class
datashield.assign

Data assignment (table or expression result)
DSI-package

DSI: 'DataSHIELD' Interface
DSLoginBuilder

DataSHIELD login details builder
DSObject-class

DSObject class
datashield.methods

List of DataSHIELD methods
datashield.connections_default

Set or get the default list of DSConnection objects in the analytic environment
datashield.pkg_check

Check server-side package minimum version
datashield.assign.table

Table assignment
datashield.errors

datashield.errors
datashield.method_status

Status of the DataSHIELD methods
datashield.connections

List the DSConnection objects in the analytic environment
datashield.logout

Logout from DataSHIELD R sessions
datashield.login

Logs in a DataSHIELD R sessions and optionaly assigns variables to R