knitr::opts_chunk$set(comment = "##",
                      tidy = TRUE, #`styler` to use styler:style_text() to reformat code
                      tidy.opts = list(blank = FALSE, width.cutoff = 60),
                      echo = TRUE,
                      eval = TRUE,
                      cache = FALSE,
                      child = NULL, #file/s to knit and then include,
                      collapse = FALSE, #collapse all output into a single block,
                      error = TRUE, #display error messages in doc. FALSE stops render when error is thrown
                      fig.align = "center", #left, right, center, or default
                      fig.width = 7, #inches
                      fig.height = 7, #inches
                      include = TRUE, #include chunk?
                      message = TRUE, #display code messages?
                      tidy = TRUE, #tidy code 
                      warning = TRUE, #include warnings?
                      results = "markup"
                        # "asis": passthrough results
                        # "hide": do not display results 
                        # "hold": put all results below all code
                      )

Last updated on: r Sys.Date()

This vignette explores reconfiguring the mCode to OMOP Mappings.

library(mOMOP)
library(tidyverse)

Combining all the maps into a single map between all the value sets and mappings.

complete_map <-
list(CANCER_STAGING, 
          GENOMICS, 
          ICD10CM, 
          LOINC, 
          SNOMED, 
          SPECIMEN, 
          UNITS_OF_MEASUREMENT) %>%
  map(mutate_all, as.character) %>%
  bind_rows()
complete_map

Names of value sets:

value_sets <-
  complete_map %>%
  rubix::split_by(col = value_set_name)
names(value_sets)

OMOP Concept Distribution Plots

Each mCode value set's OMOP mapping distribution is plotted for visual comparison of the way the concepts are represented in OMOP.

for (i in seq_along(value_sets)) {
df <-
value_sets[[i]] %>%
  count(domain_id,
        vocabulary_id,
        concept_class_id)

p <- 
  ggplot2::ggplot(
    data = df,
    aes(
      x = reorder(concept_class_id, -n),
      y = n,
      fill = domain_id
      )
    ) +
  ggplot2::geom_bar(
    stat = "identity"
    ) +
  ggplot2::theme_minimal() + 
  ggplot2::scale_y_continuous(
    expand = expansion(mult = c(0,0.05))) +
  ggplot2::labs(title = 
                  sprintf("mCode Value Set %s OMOP Concept Distribution", 
                                names(value_sets)[i]),
                x = "OMOP Concept Class",
                y = "Count") +
  ggplot2::scale_fill_brewer(palette = "Dark2") +
  ggplot2::theme(axis.text.x  = element_text(angle=45, hjust=1.1, size=8))

print(p)
}

Valueset Data

value_sets


meerapatelmd/mOMOP documentation built on June 15, 2021, 3:01 p.m.