knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  error   = FALSE,
  cache.path = file.path(R.cache::getCachePath(),
                         "chariotViz",
                         "vignettes")
)

Last Update On: r as.character(Sys.time())

library(chariotViz)
version_key <- 
  get_version_key()
rmd_print_version(version_key, 
                  "RxNorm")
library(chariotViz)
library(tidyverse)
complete_rxnorm_relationships <- 
  fetch_complete_omop_relationships(
    "RxNorm",
    version_key = get_version_key())

Updated RxNorm Concepts

updated_rxnorm_relationships <- 
  complete_rxnorm_relationships %>% 
  filter_complete_omop_relationships(invalid_reason_1 == "U",
                                     vocabulary_id_2 == "RxNorm",
                                     is.na(invalid_reason_2),
                                     concept_class_id_1 == concept_class_id_2)
updated_rxnorm_ne <- 
  create_complete_nodes_and_edges(complete_omop_relationships = updated_rxnorm_relationships)
updated_rxnorm_ne <- 
  updated_rxnorm_ne %>% 
  add_tooltip() %>%
  map_node_attributes() %>% 
  map_edge_attributes()
updated_graph <- 
  construct_graph(updated_rxnorm_ne)
chariotViz(updated_graph)
chariotViz(updated_graph %>% 
             remap_fillcolor_by_invalid_reason())
construct_node_legend(updated_graph %>% 
                   remap_fillcolor_by_invalid_reason())
construct_edge_legend(updated_graph %>% 
                   remap_fillcolor_by_invalid_reason())

Deleted RxNorm Concepts

deleted_rxnorm_relationships <- 
  complete_rxnorm_relationships %>% 
  filter_complete_omop_relationships(invalid_reason_1 == "D",
                                     vocabulary_id_2 == "RxNorm",
                                     is.na(invalid_reason_2),
                                     concept_class_id_1 == concept_class_id_2)
deleted_rxnorm_ne <- 
  create_complete_nodes_and_edges(complete_omop_relationships = deleted_rxnorm_relationships)
deleted_rxnorm_ne <- 
  deleted_rxnorm_ne %>% 
  add_tooltip() %>%
  map_node_attributes() %>% 
  map_edge_attributes()
deleted_graph <- 
  construct_graph(deleted_rxnorm_ne)
chariotViz(deleted_graph)
chariotViz(deleted_graph %>% 
             remap_fillcolor_by_invalid_reason())
construct_node_legend(
  deleted_graph %>%
    remap_fillcolor_by_invalid_reason())
construct_edge_legend(
  deleted_graph %>% 
    remap_fillcolor_by_invalid_reason())


meerapatelmd/chariotViz documentation built on Dec. 21, 2021, 4:53 p.m.