The goal of OmopConcepts is to maintain a concept set expression library and provide the interface to download concepts from it. Note this package uses the internet, so you will need to be connected to the internet to download the different concept sets that are hosted in the GitHub repository.
Installation
You can install the development version of OmopConcepts from GitHub with:
# install.packages("pak")
pak::pkg_install("OHDSI/OmopConcepts")Citation
Please do cite the package and the relevant codelists if it was useful.
#> Warning in citation("OmopConcepts"): could not determine year for
#> 'OmopConcepts' from package DESCRIPTION file
#> To cite package 'OmopConcepts' in publications use:
#>
#> Català M (????). _OmopConcepts: Concepts Set Expressions for the OMOP
#> Common Data Model_. R package version 0.1.0,
#> <https://OHDSI.github.io/OmopConcepts/>.
#>
#> A BibTeX entry for LaTeX users is
#>
#> @Manual{,
#> title = {OmopConcepts: Concepts Set Expressions for the OMOP Common Data Model},
#> author = {Martí Català},
#> note = {R package version 0.1.0},
#> url = {https://OHDSI.github.io/OmopConcepts/},
#> }Download concept
You can easily download a concept set expression using the package, you just need to know the name of the concept (or concepts) that you want to download:
library(OmopConcepts)
downloadConceptSet(conceptSetName = "heart_failure")
#>
#> ── 1 concept set expression ────────────────────────────────────────────────────
#>
#> - heart_failure (1 concept criteria)
downloadConceptSet(conceptSetName = c("heart_failure", "arthritis"))
#>
#> ── 2 concept set expressions ───────────────────────────────────────────────────
#>
#> - arthritis (1 concept criteria)
#> - heart_failure (1 concept criteria)You can also download using a tag (e.g. each tag stands for several concept sets):
downloadConceptSet(conceptSetName = "@table1")
#>
#> ── 2 concept set expressions ───────────────────────────────────────────────────
#>
#> - arthritis (1 concept criteria)
#> - heart_failure (1 concept criteria)You can retrieve all the available concept sets in the library programmatically:
availableConceptSets()
#> [1] "heart_failure" "arthritis"Please do take a look to the concept library documentation where the different concept sets (and tags) are documented.
Concept set expression to codelist
The downloaded concepts will always be in concept set expression format so if you want to evaluate them (descendants and exclusions) to obtain the codelist you can use the function validateConceptSetArgument(), note that you will need a cdm object with the vocabulary tables in order to be able to apply the logic of the concept set expression. In this case we will use the mock dataset empty_cdm provided by omock with v5.0 22-JUN-22 vocabularies.
library(omock)
cdm <- mockCdmFromDataset(datasetName = "empty_cdm", source = "duckdb")
#> ℹ Reading empty_cdm tables.
#> ℹ Adding drug_strength table.
cdm
#>
#> ── # OMOP CDM reference (duckdb) of empty_cdm ──────────────────────────────────
#> • omop tables: attribute_definition, care_site, cdm_source, cohort_definition,
#> concept, concept_ancestor, concept_class, concept_relationship,
#> concept_synonym, condition_era, condition_occurrence, cost, death,
#> device_exposure, domain, dose_era, drug_era, drug_exposure, drug_strength,
#> fact_relationship, location, measurement, metadata, note, note_nlp,
#> observation, observation_period, payer_plan_period, person,
#> procedure_occurrence, provider, relationship, source_to_concept_map, specimen,
#> visit_detail, visit_occurrence, vocabulary
#> • cohort tables: -
#> • achilles tables: -
#> • other tables: -
cs <- downloadConceptSet(conceptSetName = "@table1")
cs
#>
#> ── 2 concept set expressions ───────────────────────────────────────────────────
#>
#> - arthritis (1 concept criteria)
#> - heart_failure (1 concept criteria)
codelist <- validateConceptSetArgument(conceptSet = cs, cdm = cdm)
codelist
#>
#> ── 2 codelists ─────────────────────────────────────────────────────────────────
#>
#> - arthritis (836 codes)
#> - heart_failure (116 codes)Contribute to the package
The library is open to external contributions please do take a look to the How to contribute vignette that describes the process to contribute to the library.