Opal Projects API

Yannick Marcon

2020-06-08

Opal stores data and meta-data in projects that are accessible through web services. See the Variables and Data documentation page that explains the data model of Opal. The Opal R package exposes projects related functions:

Note that these functions do not create a R session on the server side: it is only accessing the content of the Opal server (permission checks apply).

Setup the connection with Opal:

library(opalr)
o <- opal.login("administrator", "password", "https://opal-demo.obiba.org")

List the projects:

opal.projects(o)

List the datasources (there is one per project) to get the details about how the data are persisted and what are the tables:

opal.datasources(o)

List the tables in a datasource, with their count of variables and entities:

opal.tables(o, datasource = "CPTP", counts = TRUE)

List the variables of a table and get the details of the variable annotations (one column per variable attribute with namespace):

opal.variables(o, datasource = "CPTP", table = "Coreqx_final")

Get the values in a table for a specific entity:

opal.valueset(o, datasource = "FNAC", table = "FNAC", identifier = "1000502517535681229")

Variable attributes can be described by taxonomies. List the taxonomies:

opal.taxonomies(o)

List the vocabularies of a taxonomy:

opal.vocabularies(o, taxonomy = "Mlstr_area")

List the terms of a vocabulary:

opal.terms(o, taxonomy = "Mlstr_area", vocabulary = "Lifestyle_behaviours")

Good practice is to free server resources by sending a logout request:

opal.logout(o)