knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(chariot)
library(tidyverse)

Harmonizing HemOnc concepts entails getting a combination of Regimens and Components, reducing the combination down to the Component level, and finding Regimens and/or Regimen and Component combinations that map to the reduced list.

For example, the Regimen FOLFOX along with Irinotecan would harmonize to FOLFIRINOX.

FOLFOX <- get_concept(concept_id = 35806596)
Irinotecan <- get_concept(concept_id = 35803130)

To check for this, the FOLFOX plus Irinotecan combination are reduced to Components.

new_components <- 
  ho_reduce_to_components(FOLFOX,
                        Irinotecan)
new_components

The components can then be submitted to generate a potential regimen match.

new_regimen <- 
  ho_lookup_regimen(new_components$concept_id)
new_regimen

In this case, various combinations existed. However, what if a combination does not cleanly map to a HemOnc Regimen? For example, sometimes there is an add-on drug to an established Regimen for experimental reasons.

For demonstration purposes, suppose the new Components reduced down to Fluorouracil, Folinic acid, Oxaliplatin, and Irinotecan as well as Trastuzumab.

Trastuzumab <- get_concept(concept_id = 35803361)
Trastuzumab
new_component_ids2 <- c(new_components$concept_id, Trastuzumab@concept_id)
new_component_ids2
new_regimen2 <- ho_lookup_regimen(new_component_ids2)

In this case, a regimen was not found as indicated by a zero row result.

new_regimen2

To find possible Regimen and Component combinations instead, subsets of the Components can be submitted to find matches using ho_grep_regimens() with starting component_count 1 value less than the total Component count. In this case, it is 4.

The Concept classes are retrieved for each of the Components.

new_component_objs2 <- lapply(new_component_ids2,
                              get_concept)
names(new_component_objs2) <- lapply(new_component_objs2,
                                     function(x) slot(x, "concept_name"))
new_component_objs2

All the possible Component permutations are made by removing one of the Components.

new_component_permutations <- list()
for (i in seq_along(new_component_objs2)) {
  new_component_permutations[[i]] <-
  new_component_objs2[-i]
  names(new_component_permutations)[i] <- new_component_objs2[[i]]@concept_name
}

The resulting input is of the same length as the source Components (5) and each value in the list is composed of 4 (5 minus 1) Components. The names of the removed Component in a particular permutation is also saved as the name.

The permutations are mapped to Regimens.

new_regimens2 <- list()
for (i in seq_along(new_component_permutations)) {

  new_regimens2[[i]] <-
  ho_lookup_regimen(new_component_permutations[[i]])
}
names(new_regimens2) <- names(new_component_permutations)
new_regimens2 <-
  new_regimens2 %>%
  purrr::keep(~ nrow(.) > 0)
new_regimens2

Filtering for only the permutations that returned greater than zero rows, there are 3 potential regimens that a subset of 4 Components map to:

new_regimens2 %>% 
  bind_rows(.id = "add_on_component_name") %>%
  select(add_on_component_name, regimen_concept_id, regimen_concept_name) %>%
  distinct()

Therefore, the possible combinations are either FOLFIRINOX plus Trastuzumab, mFOLFIRINOX plus Trastuzumab, or FOLFIRINOX/modified FOLFIRINOX plus /- Chemoradiation plus Trastuzumab.

It is possible that the permutations do not return any rows in this scenario. If this is the case, it is likely more feasible to manually look up the mapping at \url{athena.ohdsi.org} than to programmatically find matches.



patelm9/chariot documentation built on Feb. 19, 2022, 11:29 a.m.