# Exploring the OMOP CDM vocabulary tables

In this vignette, we will explore the functions that help us delve into the vocabularies used in our database. These functions allow us to explore the different vocabularies and concepts characteristics.

First of all, we will load the required packages and a eunomia database.

    library(DBI)
    library(dplyr)
    library(CDMConnector)
    library(CodelistGenerator)

    # Connect to the database and create the cdm object
    con <- dbConnect(duckdb::duckdb(),
                     eunomiaDir("synpuf-1k", "5.3"))
    cdm <- cdmFromCon(con = con,
                      cdmName = "Eunomia Synpuf",
                      cdmSchema   = "main",
                      writeSchema = "main",
                      achillesSchema = "main")

Note that we have included achilles tables in our cdm reference, which are used for some of the analyses.

## Vocabulary characteristics

We can first start by getting the vocabulary version of our CDM object:

    vocabularyVersion(cdm)

And the available vocabularies, which correspond to the column vocabulary_id from the concept table:

    availableVocabularies(cdm)

## Domains

We can also explore the domains that our CDM object has, which is the column domain_id from the concept table:

    availableDomains(cdm)

or restrict the search among standard concepts:

    availableDomains(cdm,
                     standardConcept = "Standard")

## Concept class

We can further explore the different classes that we have (reported in concept_class_id column from the concept table):

    availableConceptClassIds(cdm)

Or restrict the search among non-standard concepts with condition domain:

    availableConceptClassIds(cdm,
                             standardConcept = "Non-standard",
                             domain = "Condition")

## Relationships

We can also explore the different relationships that are present in our CDM:

    availableRelationshipIds(cdm)

Or narrow the search among standard concepts with domain observation:

    availableRelationshipIds(cdm,
                             standardConcept1 = "Standard",
                             standardConcept2 = "Standard",
                             domains1 = "Observation",
                             domains2 = "Observation")