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:

term

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

code

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

cl_code

The code of the associated code list.

cl_name

The name 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 × 4
#>   code    term  cl_code cl_name                                 
#>   <chr>   <chr> <chr>   <chr>                                   
#> 1 C184459 DNA   C101832 Findings About Test Code                
#> 2 C449    DNA   C111114 Genetic Sample Type                     
#> 3 C135409 DNA   C65047  Laboratory Test Code                    
#> 4 C184459 DNA   C163027 Type 1 Diabetes Findings About Test Code
#> 5 C812    RNA   C111114 Genetic Sample Type                     
#> 6 C132301 RNA   C65047  Laboratory Test Code                    

# Find code lists where "Yes"/"No" terms are controlled vocabulary.
match_code_list_from_term(c("Yes", "No"))
#> # A tibble: 6 × 4
#>   code    term  cl_code cl_name                                                 
#>   <chr>   <chr> <chr>   <chr>                                                   
#> 1 C182703 Yes   C182467 Abnormal Involuntary Movement Scale Clinical Classifica…
#> 2 C182745 Yes   C182471 ATLAS Clinical Classification ORRES for ATLAS102 TN/TC  
#> 3 C182702 No    C182467 Abnormal Involuntary Movement Scale Clinical Classifica…
#> 4 C182744 No    C182471 ATLAS Clinical Classification ORRES for ATLAS102 TN/TC  
#> 5 C180261 No    C179945 Combat Exposure Scale Questionnaire ORRES for CES0101 T…
#> 6 C180271 No    C179947 Combat Exposure Scale Questionnaire ORRES for CES0103 T…

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

# C25613 however is mapped to many code lists.
match_code_list_from_code("C25613")
#> # A tibble: 3 × 4
#>   code   term  cl_code cl_name                      
#>   <chr>  <chr> <chr>   <chr>                        
#> 1 C25613 %     C85494  PK Units of Measure          
#> 2 C25613 %     C71620  Unit                         
#> 3 C25613 %     C66770  Units for Vital Signs Results

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

# Codes for code lists are for all intents and purposes not mappable to
# parent code lists.
"C141657" %in% cl_codes() # C141657 is a code list
#> [1] TRUE
match_code_list_from_code(code = "C141657")
#> # A tibble: 1 × 4
#>   code    term  cl_code cl_name
#>   <chr>   <chr> <chr>   <chr>  
#> 1 C141657 NA    NA      NA