conn <- connectAthena()

Mapping Regimens to the HemOnc Ontology as represented in the OMOP Vocabularies can be approached several different ways. The grepl approach uses pattern matching in lieu of the ontological relationships to find the appropriate HemOnc counterpart to the input.

ex1 <- ho_grep_regimens("Trastuzumab",
                 conn = conn)

In this example, all Trastuzumab monotherapy regimens in HemOnc are searched for. The monotherapy is assumed by the length of the input (1), and the function first searches for “trastuzumab” and runs an additional search for the pattern “monotherapy” based on the value of 1.

ex1
#> # A tibble: 1 x 10
#>   concept_id concept_name               domain_id vocabulary_id concept_class_id
#>        <int> <chr>                      <chr>     <chr>         <chr>           
#> 1   35805230 Ado-trastuzumab emtansine… Regimen   HemOnc        Regimen         
#> # … with 5 more variables: standard_concept <chr>, concept_code <chr>,
#> #   valid_start_date <date>, valid_end_date <date>, invalid_reason <chr>

If the search was intended to be for all regimens containing trastuzumab with a known number of additional components, a component_count value can be provided. For example, if I want to know all the HemOnc regimens that contain 2 components, with 1 being trastuzumab:

ex2 <- 
  ho_grep_regimens("Trastuzumab",
                   conn = conn, 
                   component_count = 2)

The pattern matched is “Trastuzumab” with any HemOnc Regimens containing the pattern “and” for 2 components.

ex2
#> # A tibble: 9 x 10
#>   concept_id concept_name              domain_id vocabulary_id concept_class_id
#>        <int> <chr>                     <chr>     <chr>         <chr>           
#> 1   35804299 FEC and H                 Regimen   HemOnc        Regimen         
#> 2     911988 FEC and HP                Regimen   HemOnc        Regimen         
#> 3   35804302 T-DM1 and ET              Regimen   HemOnc        Regimen         
#> 4   35102010 FEC and H (SC)            Regimen   HemOnc        Regimen         
#> 5     912073 VH and Everolimus         Regimen   HemOnc        Regimen         
#> 6   35805360 CF and Trastuzumab        Regimen   HemOnc        Regimen         
#> 7   35805363 CX and Trastuzumab        Regimen   HemOnc        Regimen         
#> 8   35804313 Pertuzumab and T-DM1      Regimen   HemOnc        Regimen         
#> 9     912067 TH (Taxol) and Everolimus Regimen   HemOnc        Regimen         
#> # … with 5 more variables: standard_concept <chr>, concept_code <chr>,
#> #   valid_start_date <date>, valid_end_date <date>, invalid_reason <chr>

For searches for component counts greater than 2, the pattern matched is the number of commas. HemOnc Regimens composed of greater than 2 components are named by a comma-separated string.

ex3 <- 
  ho_grep_regimens("Trastuzumab",
                   conn = conn, 
                   component_count = 3)

For trastuzumab regimens containing 3 components, 2 commas are searched for.

ex3
#> # A tibble: 0 x 11
#> # … with 11 variables: concept_id <int>, concept_name <chr>, domain_id <chr>,
#> #   vocabulary_id <chr>, concept_class_id <chr>, standard_concept <chr>,
#> #   concept_code <chr>, valid_start_date <date>, valid_end_date <date>,
#> #   invalid_reason <chr>, comma_count <int>

To get all the possible combinations in regimens containing the component, component_count can be set to infinity.

ex4 <- 
  ho_grep_regimens("Trastuzumab",
                   conn = conn, 
                   component_count = Inf)
#> Warning in ho_grep_regimens("Trastuzumab", conn = conn, component_count = Inf):
#> "component_count" max is: 2 returning unfiltered output

For all HemOnc functions, guardrails are put in place to prevent searches for components that may have been misspelled or subject to a typo. Here, I have mistyped trastuzumab.

ho_grep_regimens("tastuzumab",
                 conn = conn)
#> Error in ho_grep_regimens("tastuzumab", conn = conn): 'tastuzumab' is not a valid HemOnc Component

You can also look up the Components that belong to a Regimen in HemOnc.

ex5 <- ho_lookup_antineoplastics(35804201,
                          conn = conn)
ex5
#> # A tibble: 2 x 3
#>   regimen_concept_id has_antineoplastic_concept_… has_antineoplastic_concept_na…
#>                <int>                        <int> <chr>                         
#> 1           35804201                     35803229 Paclitaxel                    
#> 2           35804201                     35803361 Trastuzumab

The inverse can also be done, where a Regimen comprised by a set of Component Concept Ids is derived.

ex6 <-
ho_lookup_regimen(35803229,35803361,
                  conn = conn)
ex6
#>   regimen_concept_id regimen_concept_name has_antineoplastic_concept_id
#> 1           35804201           TH (Taxol)                      35803229
#> 2           35804201           TH (Taxol)                      35803361
#> 3           35804234         ddTH (Taxol)                      35803229
#> 4           35804234         ddTH (Taxol)                      35803361
#>   has_antineoplastic_concept_name
#> 1                      Paclitaxel
#> 2                     Trastuzumab
#> 3                      Paclitaxel
#> 4                     Trastuzumab

These functions also allow Concept Class object support. For example, for the most recent example, using a Concept Class object may allow the user to stay informed with the Concept attributes when executing the function.

Paclitaxel <- get_concept(concept_id = 35803229)
Trastuzumab <- get_concept(concept_id = 35803361)

Now we know what is being looked up while also containing the concept_id needed as the essential input for the function.

Paclitaxel
#> An object of class "concept"
#> Slot "concept_id":
#> [1] 35803229
#> 
#> Slot "concept_name":
#> [1] "Paclitaxel"
#> 
#> Slot "concept_synonym_names":
#> [1] ""
#> 
#> Slot "maps_to_concept_names":
#> [1] "paclitaxel"
#> 
#> Slot "domain_id":
#> [1] "Drug"
#> 
#> Slot "vocabulary_id":
#> [1] "HemOnc"
#> 
#> Slot "concept_class_id":
#> [1] "Component"
#> 
#> Slot "standard_concept":
#> [1] NA
#> 
#> Slot "concept_code":
#> [1] "379"
#> 
#> Slot "valid_start_date":
#> [1] "2019-05-27"
#> 
#> Slot "valid_end_date":
#> [1] "2099-12-31"
#> 
#> Slot "invalid_reason":
#> [1] NA
Trastuzumab 
#> An object of class "concept"
#> Slot "concept_id":
#> [1] 35803361
#> 
#> Slot "concept_name":
#> [1] "Trastuzumab"
#> 
#> Slot "concept_synonym_names":
#> [1] ""
#> 
#> Slot "maps_to_concept_names":
#> [1] "trastuzumab"
#> 
#> Slot "domain_id":
#> [1] "Drug"
#> 
#> Slot "vocabulary_id":
#> [1] "HemOnc"
#> 
#> Slot "concept_class_id":
#> [1] "Component"
#> 
#> Slot "standard_concept":
#> [1] NA
#> 
#> Slot "concept_code":
#> [1] "512"
#> 
#> Slot "valid_start_date":
#> [1] "2019-05-27"
#> 
#> Slot "valid_end_date":
#> [1] "2099-12-31"
#> 
#> Slot "invalid_reason":
#> [1] NA
ex7 <-
ho_lookup_regimen(Paclitaxel,
                  Trastuzumab, 
                  conn = conn)
ex7
#>   regimen_concept_id regimen_concept_name has_antineoplastic_concept_id
#> 1           35804201           TH (Taxol)                      35803229
#> 2           35804201           TH (Taxol)                      35803361
#> 3           35804234         ddTH (Taxol)                      35803229
#> 4           35804234         ddTH (Taxol)                      35803361
#>   has_antineoplastic_concept_name
#> 1                      Paclitaxel
#> 2                     Trastuzumab
#> 3                      Paclitaxel
#> 4                     Trastuzumab
dcAthena(conn = conn)