Title: | 'DataSHIELD' Implementation for 'Opal' |
---|---|
Description: | 'DataSHIELD' is an infrastructure and series of R packages that enables the remote and 'non-disclosive' analysis of sensitive research data. This package is the 'DataSHIELD' interface implementation for 'Opal', which is the data integration application for biobanks by 'OBiBa'. Participant data, once collected from any data source, must be integrated and stored in a central data repository under a uniform model. 'Opal' is such a central repository. It can import, process, validate, query, analyze, report, and export data. 'Opal' is the reference implementation of the 'DataSHIELD' infrastructure. |
Authors: | Yannick Marcon [aut, cre] |
Maintainer: | Yannick Marcon <[email protected]> |
License: | LGPL (>= 2.1) |
Version: | 1.5.0 |
Built: | 2025-02-09 04:44:54 UTC |
Source: | https://github.com/datashield/dsopal |
Aggregate some data from the DataSHIELD R session using a valid R expression. The aggregation expression must satisfy the data repository's DataSHIELD configuration.
## S4 method for signature 'OpalConnection' dsAggregate(conn, expr, async = TRUE)
## S4 method for signature 'OpalConnection' dsAggregate(conn, expr, async = TRUE)
conn |
|
expr |
Expression to evaluate. |
async |
Whether the result of the call should be retrieved asynchronously. When TRUE (default) the calls are parallelized over the connections, when the connection supports that feature, with an extra overhead of requests. |
## Not run: con <- dbConnect(DSOpal::Opal(), "username", "password", "https://opal.example.org") dsAssignTable(con, "D", "test.CNSIM") dsAggregate(con, as.symbol("meanDS(D$WEIGHT)")) dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "username", "password", "https://opal.example.org") dsAssignTable(con, "D", "test.CNSIM") dsAggregate(con, as.symbol("meanDS(D$WEIGHT)")) dsDisconnect(con) ## End(Not run)
Assign a result of the execution of an expression in the DataSHIELD R session.
## S4 method for signature 'OpalConnection' dsAssignExpr(conn, symbol, expr, async = TRUE)
## S4 method for signature 'OpalConnection' dsAssignExpr(conn, symbol, expr, async = TRUE)
conn |
|
symbol |
Name of the R symbol. |
expr |
A R expression with allowed assign functions calls. |
async |
Whether the result of the call should be retrieved asynchronously. When TRUE (default) the calls are parallelized over the connections, when the connection supports that feature, with an extra overhead of requests. |
A OpalResult-class
object.
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsAssignExpr(con, "C", as.symbol("c(1, 2, 3)")) dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsAssignExpr(con, "C", as.symbol("c(1, 2, 3)")) dsDisconnect(con) ## End(Not run)
Assign a Opal resource in the DataSHIELD R session.
## S4 method for signature 'OpalConnection' dsAssignResource(conn, symbol, resource, async = TRUE)
## S4 method for signature 'OpalConnection' dsAssignResource(conn, symbol, resource, async = TRUE)
conn |
|
symbol |
Name of the R symbol. |
resource |
Fully qualified name of a resource in Opal. |
async |
Whether the result of the call should be retrieved asynchronously. When TRUE (default) the calls are parallelized over the connections, when the connection supports that feature, with an extra overhead of requests. |
A OpalResult-class
object.
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsAssignResource(con, "D", "test.CNSIM") dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsAssignResource(con, "D", "test.CNSIM") dsDisconnect(con) ## End(Not run)
Assign a Opal table in the DataSHIELD R session.
## S4 method for signature 'OpalConnection' dsAssignTable( conn, symbol, table, variables = NULL, missings = FALSE, identifiers = NULL, id.name = NULL, async = TRUE )
## S4 method for signature 'OpalConnection' dsAssignTable( conn, symbol, table, variables = NULL, missings = FALSE, identifiers = NULL, id.name = NULL, async = TRUE )
conn |
|
symbol |
Name of the R symbol. |
table |
Fully qualified name of a table in Opal. |
variables |
List of variable names or Javascript expression that selects the variables of a table (ignored if value does not refere to a table). See javascript documentation: https://opaldoc.obiba.org/en/latest/magma-user-guide/methods.html |
missings |
If TRUE, missing values will be pushed from Opal to R, default is FALSE. Ignored if value is an R expression. |
identifiers |
Name of the identifiers mapping to use when assigning entities to R (from Opal 2.0). |
id.name |
Name of the column that will contain the entity identifiers. If not specified, the identifiers will be the data frame row names. When specified this column can be used to perform joins between data frames. |
async |
Whether the result of the call should be retrieved asynchronously. When TRUE (default) the calls are parallelized over the connections, when the connection supports that feature, with an extra overhead of requests. |
A OpalResult-class
object.
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsAssignTable(con, "D", "test.CNSIM") dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsAssignTable(con, "D", "test.CNSIM") dsDisconnect(con) ## End(Not run)
Connect to a Opal server, with provided credentials. Does not create a DataSHIELD R session, only retrieves user profile.
## S4 method for signature 'OpalDriver' dsConnect( drv, name, restore = NULL, username = NULL, password = NULL, token = NULL, url = NULL, opts = list(), profile = NULL, ... )
## S4 method for signature 'OpalDriver' dsConnect( drv, name, restore = NULL, username = NULL, password = NULL, token = NULL, url = NULL, opts = list(), profile = NULL, ... )
drv |
|
name |
Name of the connection, which must be unique among all the DataSHIELD connections. |
restore |
Workspace name to be restored in the newly created DataSHIELD R session. |
username |
User name in opal(s). |
password |
User password in opal(s). |
token |
Personal access token (since opal 2.15, ignored if username is specified). |
url |
Opal url or list of opal urls. Can be provided by "opal.url" option. |
opts |
Curl options as described by httr (call httr::httr_options() for details). Can be provided by "opal.opts" option. |
profile |
The DataSHIELD R server profile (affects the R packages available and the applied configuration). If not provided or not supported, default profile will be applied. |
... |
Unused, needed for compatibility with generic. |
A OpalConnection-class
object.
## Not run: con <- dsConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") con dsDisconnect(con) ## End(Not run)
## Not run: con <- dsConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") con dsDisconnect(con) ## End(Not run)
Disconnect from a Opal server and release all R resources. If a workspace ID is provided, the DataSHIELD R session will be saved before being destroyed.
## S4 method for signature 'OpalConnection' dsDisconnect(conn, save = NULL)
## S4 method for signature 'OpalConnection' dsDisconnect(conn, save = NULL)
conn |
|
save |
Save the DataSHIELD R session with provided ID (must be a character string). |
## Not run: con <- dsConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") con dsDisconnect(con) ## End(Not run)
## Not run: con <- dsConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") con dsDisconnect(con) ## End(Not run)
Fetch the DataSHIELD operation result.
## S4 method for signature 'OpalResult' dsFetch(res)
## S4 method for signature 'OpalResult' dsFetch(res)
res |
|
TRUE if table exists.
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsAssignExpr(con, "C", as.symbol("c(1, 2, 3)")) res <- dsAggregate(con, as.symbol("length(C)")) length <- dsFetch(res) dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsAssignExpr(con, "C", as.symbol("c(1, 2, 3)")) res <- dsAggregate(con, as.symbol("length(C)")) length <- dsFetch(res) dsDisconnect(con) ## End(Not run)
Get the information about a command (if still available).
## S4 method for signature 'OpalResult' dsGetInfo(dsObj, ...)
## S4 method for signature 'OpalResult' dsGetInfo(dsObj, ...)
dsObj |
|
... |
Unused, needed for compatibility with generic. |
The result information, including its status.
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsAssignExpr(con, "C", as.symbol("c(1, 2, 3)")) res <- dsAggregate(con, as.symbol("length(C)")) dsGetInfo(res) dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsAssignExpr(con, "C", as.symbol("c(1, 2, 3)")) res <- dsAggregate(con, as.symbol("length(C)")) dsGetInfo(res) dsDisconnect(con) ## End(Not run)
Verify Opal resource exist and can be accessible for performing DataSHIELD operations.
## S4 method for signature 'OpalConnection' dsHasResource(conn, resource)
## S4 method for signature 'OpalConnection' dsHasResource(conn, resource)
conn |
|
resource |
The fully qualified name of the resource. |
TRUE if the resource exists.
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsHasResource(con, "test.CNSIM") dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsHasResource(con, "test.CNSIM") dsDisconnect(con) ## End(Not run)
Verify Opal table exist and can be accessible for performing DataSHIELD operations.
## S4 method for signature 'OpalConnection' dsHasTable(conn, table)
## S4 method for signature 'OpalConnection' dsHasTable(conn, table)
conn |
|
table |
The fully qualified name of the table. |
TRUE if table exists.
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsHasTable(con, "test.CNSIM") dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsHasTable(con, "test.CNSIM") dsDisconnect(con) ## End(Not run)
List that Opal supports asynchronicity on all DataSHIELD operations.
## S4 method for signature 'OpalConnection' dsIsAsync(conn)
## S4 method for signature 'OpalConnection' dsIsAsync(conn)
conn |
|
The named list of logicals detailing the asynchronicity support.
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsIsAsync(con) dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsIsAsync(con) dsDisconnect(con) ## End(Not run)
Get the information about a command (if still available) and return TRUE if the command was completed successfully or not. Always TRUE for synchronous operations.
## S4 method for signature 'OpalResult' dsIsCompleted(res)
## S4 method for signature 'OpalResult' dsIsCompleted(res)
res |
|
A logical indicating the command completion.
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsAssignExpr(con, "C", as.symbol("c(1, 2, 3)")) res <- dsAggregate(con, as.symbol("length(C)")) dsIsCompleted(res) dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsAssignExpr(con, "C", as.symbol("c(1, 2, 3)")) res <- dsAggregate(con, as.symbol("length(C)")) dsIsCompleted(res) dsDisconnect(con) ## End(Not run)
Makes a dummy web service request.
## S4 method for signature 'OpalConnection' dsKeepAlive(conn)
## S4 method for signature 'OpalConnection' dsKeepAlive(conn)
conn |
|
## Not run: con <- dsConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsKeepAlive(con) dsDisconnect(con) ## End(Not run)
## Not run: con <- dsConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsKeepAlive(con) dsDisconnect(con) ## End(Not run)
List methods defined in the DataSHIELD configuration.
## S4 method for signature 'OpalConnection' dsListMethods(conn, type = "aggregate")
## S4 method for signature 'OpalConnection' dsListMethods(conn, type = "aggregate")
conn |
|
type |
Type of the method: "aggregate" (default) or "assign". |
A data frame with columns: name, type ('aggregate' or 'assign'), class ('function' or 'script'), value, package, version.
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsListMethods(con) dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsListMethods(con) dsDisconnect(con) ## End(Not run)
List packages defined in the DataSHIELD configuration.
## S4 method for signature 'OpalConnection' dsListPackages(conn)
## S4 method for signature 'OpalConnection' dsListPackages(conn)
conn |
|
A data frame with columns: name, version.
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsListPackages(con) dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsListPackages(con) dsDisconnect(con) ## End(Not run)
List profiles defined in the DataSHIELD configuration.
## S4 method for signature 'OpalConnection' dsListProfiles(conn)
## S4 method for signature 'OpalConnection' dsListProfiles(conn)
conn |
|
A list containing the "available" character vector of profile names and the "current" profile (in case a default one was assigned).
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsListProfiles(con) dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsListProfiles(con) dsDisconnect(con) ## End(Not run)
List Opal resources that may be accessible for performing DataSHIELD operations.
## S4 method for signature 'OpalConnection' dsListResources(conn)
## S4 method for signature 'OpalConnection' dsListResources(conn)
conn |
|
The fully qualified names of the resources.
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsListResources(con) dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsListResources(con) dsDisconnect(con) ## End(Not run)
List symbols living in the DataSHIELD R session.
## S4 method for signature 'OpalConnection' dsListSymbols(conn)
## S4 method for signature 'OpalConnection' dsListSymbols(conn)
conn |
|
A character vector.
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsAssignTable(con, "D", "test.CNSIM") dsListSymbols(con) dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsAssignTable(con, "D", "test.CNSIM") dsListSymbols(con) dsDisconnect(con) ## End(Not run)
List Opal tables that may be accessible for performing DataSHIELD operations.
## S4 method for signature 'OpalConnection' dsListTables(conn)
## S4 method for signature 'OpalConnection' dsListTables(conn)
conn |
|
The fully qualified names of the tables.
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsListTables(con) dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsListTables(con) dsDisconnect(con) ## End(Not run)
List workspaces saved in the data repository.
## S4 method for signature 'OpalConnection' dsListWorkspaces(conn)
## S4 method for signature 'OpalConnection' dsListWorkspaces(conn)
conn |
|
A data frame with columns: name, lastAccessDate, size.
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsListWorkspaces(con) dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsListWorkspaces(con) dsDisconnect(con) ## End(Not run)
Restore workspace from the data repository.
## S4 method for signature 'OpalConnection' dsRestoreWorkspace(conn, name)
## S4 method for signature 'OpalConnection' dsRestoreWorkspace(conn, name)
conn |
|
name |
Name of the workspace. |
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsListWorkspaces(con) dsRestoreWorkspace(con, "foo") dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsListWorkspaces(con) dsRestoreWorkspace(con, "foo") dsDisconnect(con) ## End(Not run)
Remoe a symbol living in the DataSHIELD R session.
## S4 method for signature 'OpalConnection' dsRmSymbol(conn, symbol)
## S4 method for signature 'OpalConnection' dsRmSymbol(conn, symbol)
conn |
|
symbol |
Name of the R symbol. |
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsAssignTable(con, "D", "test.CNSIM") dsRmSymbol(con, "D") dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsAssignTable(con, "D", "test.CNSIM") dsRmSymbol(con, "D") dsDisconnect(con) ## End(Not run)
Remove a workspace on the data repository.
## S4 method for signature 'OpalConnection' dsRmWorkspace(conn, name)
## S4 method for signature 'OpalConnection' dsRmWorkspace(conn, name)
conn |
|
name |
Name of the workspace. |
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsSaveWorkspace(con, "foo") dsListWorkspaces(con) dsRmWorkspace(con, "foo") dsListWorkspaces(con) dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsSaveWorkspace(con, "foo") dsListWorkspaces(con) dsRmWorkspace(con, "foo") dsListWorkspaces(con) dsDisconnect(con) ## End(Not run)
Save workspace on the data repository.
## S4 method for signature 'OpalConnection' dsSaveWorkspace(conn, name)
## S4 method for signature 'OpalConnection' dsSaveWorkspace(conn, name)
conn |
|
name |
Name of the workspace. |
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsSaveWorkspace(con, "foo") dsListWorkspaces(con) dsDisconnect(con) ## End(Not run)
## Not run: con <- dbConnect(DSOpal::Opal(), "server1", "username", "password", "https://opal.example.org") dsSaveWorkspace(con, "foo") dsListWorkspaces(con) dsDisconnect(con) ## End(Not run)
DataSHIELD login data file based on Opal demo server, with CNSIM simulated data. The CNSIM datasets contain synthetic data based on a model derived from the participants of the 1958 Birth Cohort, as part of the obesity methodological development project. These datasets do contain some NA values. Note that the Opal demo server is rebuilt every day and is possibly not accessible.
Field | Description | Type | Note |
server | Server/study name | char | |
url | Server/study URL | char | Opal demo URL |
user | User name | char | |
password | User password | char | |
table | Table unique name | char | CNSIM tables |
driver | Connection driver | char | OpalDriver |
Convenient function for creating a OpalDriver object.
Opal()
Opal()