Author: Yannick Marcon
Date: 2026-02-06

# Mica Search API

#### Yannick Marcon

#### 2026-02-06

Mica provides some web services for searching content. The Mica R package exposes search related functions:

- search query can mix network, study, dataset and variable criteria,
- RQL (Resource Query Language) support for expressing search requests (note that queries can be copied from Search page in the web UI),
- results are data frames that can be used for subsequent filtering and reporting.

Setup the connection with Mica, login with anonymous user and default password (to be changed):

    library(micar)
    m <- mica.login(url="https://mica-demo.obiba.org")

Get the 10 first networks which datasets have variables matching the provided criteria:

    mica.networks(m, query="variable(in(Mlstr_area.Lifestyle_behaviours,Drugs))", locale="en", from=0, limit=10)

Get the 100 first studies matching the provided study criteria:

    mica.studies(m, query="study(in(Mica_study.methods-design,cohort_study))")

Study populations and data collection events (DCE) can also be queried:

    mica.study.populations(m, query="study(in(Mica_study.methods-design,cohort_study))")
    mica.study.dces(m, query="study(in(Mica_study.methods-design,cohort_study))")

Get some datasets which variables are about Drugs usage:

    mica.datasets(m, query="variable(in(Mlstr_area.Lifestyle_behaviours,Drugs))")

Get the corresponding variables:

    mica.variables(m, query="variable(in(Mlstr_area.Lifestyle_behaviours,Drugs))")

The search query expression is based on the declared taxonomies, vocabularies and terms. The following functions allow to query for terms matching some open text criteria, for instance get the vocabulary terms about cancer across all the variable taxonomies:

    mica.vocabularies(m, target="variable", query="cancer", locale = "en")

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

    mica.logout(m)