Skip to contents

match_code_list_from_term() takes terms as queries to look for associated code lists.

match_code_list_from_code() does the same starting from C-codes.

Note that both mappings are potentially one to many as the same code or term may associate with more than one code list.

Usage

match_code_list_from_term(term)

match_code_list_from_code(code)

Arguments

term

A character vector of SDTM terminology terms.

code

A character vector of SDTM terminology C-codes.

Value

A tibble with at least as many rows as there are elements in term, but potentially more because of one-to-many mappings. The returned tibble comprises three columns:

code

An SDTM terminology code (e.g. "C141701").

term

An SDTM terminology term (e.g. "TENMW104").

clst_code

The code of the associated code list.

Examples

# Find code lists where "DNA" and "RNA" are used.
match_code_list_from_term(c("DNA", "RNA"))
#> # A tibble: 6 × 3
#>   code    term  clst_code
#>   <chr>   <chr> <chr>    
#> 1 C184459 DNA   C101832  
#> 2 C449    DNA   C111114  
#> 3 C135409 DNA   C65047   
#> 4 C184459 DNA   C163027  
#> 5 C812    RNA   C111114  
#> 6 C132301 RNA   C65047   

# Find code lists where "Yes"/"No" terms are controlled vocabulary.
match_code_list_from_term(c("Yes", "No"))
#> # A tibble: 6 × 3
#>   code    term  clst_code
#>   <chr>   <chr> <chr>    
#> 1 C182703 Yes   C182467  
#> 2 C182745 Yes   C182471  
#> 3 C182702 No    C182467  
#> 4 C182744 No    C182471  
#> 5 C180261 No    C179945  
#> 6 C180271 No    C179947  

# C163560 is found in code list C71620.
match_code_list_from_code("C163560")
#> # A tibble: 1 × 3
#>   code    term  clst_code
#>   <chr>   <chr> <chr>    
#> 1 C163560 %/s   C71620   

# C25613 however is mapped to many code lists.
match_code_list_from_code("C25613")
#> # A tibble: 3 × 3
#>   code   term  clst_code
#>   <chr>  <chr> <chr>    
#> 1 C25613 %     C85494   
#> 2 C25613 %     C71620   
#> 3 C25613 %     C66770   

# Unmappable codes or terms map to `NA`.
match_code_list_from_code("Yoda")
#> # A tibble: 1 × 3
#>   code  term  clst_code
#>   <chr> <chr> <chr>    
#> 1 Yoda  NA    NA       
match_code_list_from_term("R2D2")
#> # A tibble: 1 × 3
#>   code  term  clst_code
#>   <chr> <chr> <chr>    
#> 1 NA    R2D2  NA       

# Codes for code lists are for all intents and purposes not mappable to
# parent code lists.
match_code_list_from_code(code = "C141657")
#> # A tibble: 1 × 3
#>   code    term  clst_code
#>   <chr>   <chr> <chr>    
#> 1 C141657 NA    NA