Version: 1.1.2
Title: 'Mica' Data Web Portal Client
Depends: R (≥ 3.0.0), httr
Imports: jsonlite
Suggests: knitr, rmarkdown
Description: 'Mica' is a server application used to create data web portals for large-scale epidemiological studies or multiple-study consortia. 'Mica' helps studies to provide scientifically robust data visibility and web presence without significant information technology effort. 'Mica' provides a structured description of consortia, studies, annotated and searchable data dictionaries, and data access request management. This 'Mica' client allows to perform data extraction for reporting purposes.
License: GPL-3
URL: https://www.obiba.org/ https://www.obiba.org/pages/products/mica/ https://doi.org/10.1093/ije/dyx180
BugReports: https://github.com/obiba/micar
RoxygenNote: 7.1.1
VignetteBuilder: knitr
Encoding: UTF-8
NeedsCompilation: no
Packaged: 2021-04-16 12:23:58 UTC; yannick
Author: Yannick Marcon ORCID iD [aut, cre], OBiBa group [cph]
Maintainer: Yannick Marcon <yannick.marcon@obiba.org>
Repository: CRAN
Date/Publication: 2021-04-16 12:50:02 UTC

Insert some RQL statements to perform the query. TODO parse RQL properly!

Description

Insert some RQL statements to perform the query. TODO parse RQL properly!

Usage

.append.rql(query, target, select, sort, from, limit, locale)

Utility method to build RQL atomic statement.

Description

Utility method to build RQL atomic statement.

Usage

.as.rql(name, args)

Constructs the value for the Authorization header

Description

Constructs the value for the Authorization header

Usage

.authToken(username, password)

Make a list of DataAccessRequest DTOs a data frame (applies to DARs and their amendments)

Description

Make a list of DataAccessRequest DTOs a data frame (applies to DARs and their amendments)

Usage

.darDTOToDF(res)

Make a list of StatusChange DTOs a data frame (applies to DARs and their amendments)

Description

Make a list of StatusChange DTOs a data frame (applies to DARs and their amendments)

Usage

.darStatusDTOToDF(darId, res)

Extract label for locale. If not found, fallback to undefined language label (if any).

Description

Extract label for locale. If not found, fallback to undefined language label (if any).

Usage

.extractLabel(
  locale = "en",
  labels = list(),
  localeKey = "lang",
  valueKey = "value"
)

Extract label for locale. If not found, fallback to undefined language label (if any).

Description

Extract label for locale. If not found, fallback to undefined language label (if any).

Usage

.extractLabel2(
  locale = "en",
  labels = list(),
  localeKey = "locale",
  valueKey = "text"
)

Extract micasid from cookie data frame.

Description

Extract micasid from cookie data frame.

Usage

.extractMicaSessionId(cookies)

Flatten a list hierarchy

Description

Flatten a list hierarchy

Usage

.flatten(content, locale = "en")

Issues a GET request to mica for the specified resource

Description

Issues a GET request to mica for the specified resource

Usage

.get(mica, ..., query = list())

Default request response handler.

Description

Default request response handler.

Usage

.handleResponse(mica, response)

Issues a POST form request to mica for the specified resource

Description

Issues a POST form request to mica for the specified resource

Usage

.post(mica, ..., query = list())

Display search result metrics

Description

Display search result metrics

Usage

.reportListMetrics(results)

Utility method to build urls. Concatenates all arguments and adds a '/' separator between each element

Description

Utility method to build urls. Concatenates all arguments and adds a '/' separator between each element

Usage

.url(mica, ...)

Verbose flag

Description

Verbose flag

Usage

.verbose()

Get a data access request

Description

Get a specific data access request.

Usage

mica.dar(mica, id)

Arguments

mica

A Mica object

id

Data access request identifier

See Also

Other data access requests functions: mica.dar.actions(), mica.dar.amendment.form(), mica.dar.amendment.history(), mica.dar.amendments.history(), mica.dar.amendments(), mica.dar.amendment(), mica.dar.form(), mica.dar.history(), mica.dars()

Examples

## Not run: 
m <- mica.login("someuser", "somepassword", "https://mica-demo.obiba.org")
mica.dar(m, "12345")
mica.logout(m)

## End(Not run)

Get data access request actions

Description

Get the actions history of a specific data access request.

Usage

mica.dar.actions(mica, id, df = TRUE)

Arguments

mica

A Mica object

id

Data access request identifier

df

Return a data.frame (default is TRUE)

See Also

Other data access requests functions: mica.dar.amendment.form(), mica.dar.amendment.history(), mica.dar.amendments.history(), mica.dar.amendments(), mica.dar.amendment(), mica.dar.form(), mica.dar.history(), mica.dars(), mica.dar()

Examples

## Not run: 
m <- mica.login("someuser", "somepassword", "https://mica-demo.obiba.org")
mica.dar.actions(m, "12345")
mica.logout(m)

## End(Not run)

Get a amendment

Description

Get a specific data access request amendment.

Usage

mica.dar.amendment(mica, pid, id)

Arguments

mica

A Mica object

pid

Data access request identifier

id

Amendment identifier

See Also

Other data access requests functions: mica.dar.actions(), mica.dar.amendment.form(), mica.dar.amendment.history(), mica.dar.amendments.history(), mica.dar.amendments(), mica.dar.form(), mica.dar.history(), mica.dars(), mica.dar()

Examples

## Not run: 
m <- mica.login("someuser", "somepassword", "https://mica-demo.obiba.org")
mica.dar.amendment(m, "12345", "12345-1")
mica.logout(m)

## End(Not run)

Get the data access request amendment form

Description

Get the data access request amendment form.

Usage

mica.dar.amendment.form(mica)

Arguments

mica

A Mica object

See Also

Other data access requests functions: mica.dar.actions(), mica.dar.amendment.history(), mica.dar.amendments.history(), mica.dar.amendments(), mica.dar.amendment(), mica.dar.form(), mica.dar.history(), mica.dars(), mica.dar()

Examples

## Not run: 
m <- mica.login("someuser", "somepassword", "https://mica-demo.obiba.org")
mica.dar.amendment.form(m)
mica.logout(m)

## End(Not run)

Get amendment history

Description

Get the history of a specific data access request amendment.

Usage

mica.dar.amendment.history(mica, pid, id, df = TRUE)

Arguments

mica

A Mica object

pid

Data access request identifier

id

Amendment identifier

df

Return a data.frame (default is TRUE)

See Also

Other data access requests functions: mica.dar.actions(), mica.dar.amendment.form(), mica.dar.amendments.history(), mica.dar.amendments(), mica.dar.amendment(), mica.dar.form(), mica.dar.history(), mica.dars(), mica.dar()

Examples

## Not run: 
m <- mica.login("someuser", "somepassword", "https://mica-demo.obiba.org")
mica.dar.amendment.history(m, "12345", "12345-1")
mica.logout(m)

## End(Not run)

Get amendments

Description

Get the list of amendments of a specific data access request.

Usage

mica.dar.amendments(mica, pid, status = NULL, df = TRUE)

Arguments

mica

A Mica object

pid

Data access request identifier

status

Filter by status

df

Return a data.frame (default is TRUE)

See Also

Other data access requests functions: mica.dar.actions(), mica.dar.amendment.form(), mica.dar.amendment.history(), mica.dar.amendments.history(), mica.dar.amendment(), mica.dar.form(), mica.dar.history(), mica.dars(), mica.dar()

Examples

## Not run: 
m <- mica.login("someuser", "somepassword", "https://mica-demo.obiba.org")
mica.dar.amendments(m, "12345")
mica.logout(m)

## End(Not run)

Get amendments history

Description

Get the history of the amendments of a specific data access request.

Usage

mica.dar.amendments.history(mica, pid, df = TRUE)

Arguments

mica

A Mica object

pid

Data access request identifier

df

Return a data.frame (default is TRUE)

See Also

Other data access requests functions: mica.dar.actions(), mica.dar.amendment.form(), mica.dar.amendment.history(), mica.dar.amendments(), mica.dar.amendment(), mica.dar.form(), mica.dar.history(), mica.dars(), mica.dar()

Examples

## Not run: 
m <- mica.login("someuser", "somepassword", "https://mica-demo.obiba.org")
mica.dar.amendments.history(m, "12345")
mica.logout(m)

## End(Not run)

Get the data access request form

Description

Get the data access request form.

Usage

mica.dar.form(mica)

Arguments

mica

A Mica object

See Also

Other data access requests functions: mica.dar.actions(), mica.dar.amendment.form(), mica.dar.amendment.history(), mica.dar.amendments.history(), mica.dar.amendments(), mica.dar.amendment(), mica.dar.history(), mica.dars(), mica.dar()

Examples

## Not run: 
m <- mica.login("someuser", "somepassword", "https://mica-demo.obiba.org")
mica.dar.form(m)
mica.logout(m)

## End(Not run)

Get data access request history

Description

Get the history of a specific data access request.

Usage

mica.dar.history(mica, id, df = TRUE)

Arguments

mica

A Mica object

id

Data access request identifier

df

Return a data.frame (default is TRUE)

See Also

Other data access requests functions: mica.dar.actions(), mica.dar.amendment.form(), mica.dar.amendment.history(), mica.dar.amendments.history(), mica.dar.amendments(), mica.dar.amendment(), mica.dar.form(), mica.dars(), mica.dar()

Examples

## Not run: 
m <- mica.login("someuser", "somepassword", "https://mica-demo.obiba.org")
mica.dar.history(m, "12345")
mica.logout(m)

## End(Not run)

Get the data access requests

Description

Get the data access requests.

Usage

mica.dars(mica, status = NULL, df = TRUE)

Arguments

mica

A Mica object

status

Filter by status

df

Return a data.frame (default is TRUE)

See Also

Other data access requests functions: mica.dar.actions(), mica.dar.amendment.form(), mica.dar.amendment.history(), mica.dar.amendments.history(), mica.dar.amendments(), mica.dar.amendment(), mica.dar.form(), mica.dar.history(), mica.dar()

Examples

## Not run: 
m <- mica.login("someuser", "somepassword", "https://mica-demo.obiba.org")
mica.dars(m)
mica.logout(m)

## End(Not run)

Get the datasets

Description

Get the datasets

Usage

mica.datasets(
  mica,
  query = "dataset()",
  select = list("*"),
  sort = list("id"),
  from = 0,
  limit = 10000,
  locale = "en",
  df = TRUE
)

Arguments

mica

A Mica object

query

The search query

select

The fields to be extracted

sort

The fields to sort by

from

From item

limit

Max number of items

locale

The language for labels (default is "en")

df

Return a data.frame (default is TRUE)

Examples

## Not run: 
m <- mica.login("https://mica-demo.obiba.org")
mica.datasets(m, query="variable(in(Mlstr_area.Lifestyle_behaviours,Drugs))")
mica.logout(m)

## End(Not run)

Open connection with Mica

Description

Open a connection with Mica and returns a Mica object.

Usage

mica.login(
  username = getOption("mica.username", "anonymous"),
  password = getOption("mica.password", "password"),
  url = getOption("mica.url"),
  opts = getOption("mica.opts", list())
)

Arguments

username

User name in mica. Can be provided by "mica.username" option.

password

User password in mica. Can be provided by "mica.password" option.

url

Mica url or list of mica urls. Can be provided by "mica.url" option.

opts

Curl options. Can be provided by "mica.opts" option.

Value

A Mica object.

Examples

## Not run: 
# login using credentials from mica.username and mica.password options
m <- mica.login("https://mica-demo.obiba.org")
# login by providing credentials
m <- mica.login("administrator", "password", "https://mica-demo.obiba.org")

## End(Not run)

Close connection with Mica

Description

Close connection and release resources of Mica.

Usage

mica.logout(mica)

Arguments

mica

A Mica object

Examples

## Not run: 
m <- mica.login("https://mica-demo.obiba.org")
mica.logout(m)

## End(Not run)

Get the networks

Description

Get the networks

Usage

mica.networks(
  mica,
  query = "network()",
  select = list("*"),
  sort = list("id"),
  from = 0,
  limit = 100,
  locale = "en",
  df = TRUE
)

Arguments

mica

A Mica object

query

The search query

select

The fields to be extracted

sort

The fields to sort by

from

From item

limit

Max number of items

locale

The language for labels (default is "en")

df

Return a data.frame (default is TRUE)

Examples

## Not run: 
m <- mica.login("https://mica-demo.obiba.org")
mica.networks(m, query="network(in(Mica_network.studyIds,clsa))")
mica.logout(m)

## End(Not run)

Get the studies

Description

Get the studies

Usage

mica.studies(
  mica,
  query = "study()",
  select = list("acronym", "name", "objectives", "model",
    "populations.dataCollectionEvents.model.dataSources"),
  sort = list("id"),
  from = 0,
  limit = 100,
  locale = "en",
  df = TRUE
)

Arguments

mica

A Mica object

query

The search query

select

The fields to be extracted

sort

The fields to sort by

from

From item

limit

Max number of items

locale

The language for labels (default is "en")

df

Return a data.frame (default is TRUE)

See Also

Other studies functions: mica.study.dces(), mica.study.populations()

Examples

## Not run: 
m <- mica.login("https://mica-demo.obiba.org")
mica.studies(m, query="variable(in(Mlstr_area.Lifestyle_behaviours,Drugs))", 
  locale="en", from=0, limit=10)
mica.logout(m)

## End(Not run)

Get the study data collection events

Description

Get the study data collection events (DCEs). Note that the DCEs are not fetched directly, they are extracted from study search results.

Usage

mica.study.dces(
  mica,
  query = "study()",
  select = list("populations.dataCollectionEvents"),
  sort = list("id"),
  from = 0,
  limit = 100,
  locale = "en",
  df = TRUE
)

Arguments

mica

A Mica object

query

The search query

select

The fields to be extracted

sort

The fields to sort by

from

From item

limit

Max number of items. Note that this limit applies to the studies that are fetched, the resulting count of DCEs will be higher.

locale

The language for labels (default is "en")

df

Return a data.frame (default is TRUE)

See Also

Other studies functions: mica.studies(), mica.study.populations()

Examples

## Not run: 
m <- mica.login("https://mica-demo.obiba.org")
mica.study.dces(m, query="study(in(Mica_study.methods-design,cohort_study))")
mica.logout(m)

## End(Not run)

Get the study populations

Description

Get the study populations. Note that the populations are not fetched directly, they are extracted from study search results.

Usage

mica.study.populations(
  mica,
  query = "study()",
  select = list("populations.name", "populations.description", "populations.model"),
  sort = list("id"),
  from = 0,
  limit = 100,
  locale = "en",
  df = TRUE
)

Arguments

mica

A Mica object

query

The search query

select

The fields to be extracted

sort

The fields to sort by

from

From item

limit

Max number of items. Note that this limit applies to the studies that are fetched, the resulting count of populations will be higher.

locale

The language for labels (default is "en")

df

Return a data.frame (default is TRUE)

See Also

Other studies functions: mica.studies(), mica.study.dces()

Examples

## Not run: 
m <- mica.login("https://mica-demo.obiba.org")
mica.study.populations(m, query="study(in(Mica_study.methods-design,cohort_study))")
mica.logout(m)

## End(Not run)

Get the taxonomies

Description

Get the taxonomies, optionally filtered by taxonomy name and by term matching.

Usage

mica.taxonomies(
  mica,
  query = NULL,
  locale = "en",
  target = "variable",
  taxonomies = NULL,
  df = TRUE
)

Arguments

mica

A Mica object

query

The search query

locale

The language for labels (when NULL labels are not included in the result)

target

What the taxonomy is about: variable (default), dataset, study, network

taxonomies

Taxonomy names to subset. If NULL or empty all taxonomies are returned

df

Return a data.frame (default is TRUE)

See Also

Other taxonomies functions: mica.vocabularies()

Examples

## Not run: 
m <- mica.login("https://mica-demo.obiba.org")
mica.taxonomies(m, target="variable", query="sex", locale="en",
  taxonomies = list("Mlstr_area", "Mlstr_additional"))
mica.logout(m)

## End(Not run)

Get the variables

Description

Get the variables

Usage

mica.variables(
  mica,
  query = "variable()",
  select = list("*"),
  sort = list("id"),
  from = 0,
  limit = 10000,
  locale = "en",
  df = TRUE
)

Arguments

mica

A Mica object

query

The search query

select

The fields to be extracted

sort

The fields to sort by

from

From item

limit

Max number of items

locale

The language for labels (default is "en")

df

Return a data.frame (default is TRUE)

Examples

## Not run: 
m <- mica.login("https://mica-demo.obiba.org")
mica.variables(m, query="variable(in(Mlstr_area.Lifestyle_behaviours,Drugs))")
mica.logout(m)

## End(Not run)

Get the vocabularies

Description

Get the taxonomy vocabularies, optionally filtered by taxonomy name and by term matching.

Usage

mica.vocabularies(
  mica,
  query = NULL,
  locale = "en",
  target = "variable",
  taxonomies = NULL,
  df = TRUE
)

Arguments

mica

A Mica object

query

The search query

locale

The language for labels (when NULL labels are not included in the result)

target

What the taxonomy is about: variable (default), dataset, study, network

taxonomies

Taxonomy names to subset. If NULL or empty all taxonomies are returned

df

Return a data.frame (default is TRUE)

See Also

Other taxonomies functions: mica.taxonomies()

Examples

## Not run: 
m <- mica.login("https://mica-demo.obiba.org")
mica.vocabularies(m,target="variable", query="cancer", locale = "en")
mica.logout(m)

## End(Not run)

New RQL node

Description

Creates a new RQL node that represents an operation.

Usage

rqlNode(name, ...)

Arguments

name

The name of the operator

...

The arguments of the operation