Skip to contents

Returns a codelist with clinical codes that match the provided description pattern.

Usage

DESCRIPTION(
  pattern,
  type = getOption("codeminer.code_type"),
  lookup_version = getOption("codeminer.lookup_version", default = "latest"),
  ignore_case = TRUE,
  preferred_description_only = TRUE,
  col_filters = "default"
)

Arguments

pattern

The description to search for. See stringr::str_detect() for details.

type

character. Type of clinical code system to be searched. Optional if input is a data frame with code_type column. Depends on what is available in the lookup tables. See add_lookup_table() on how to add new lookup tables. This can also be configured through the codeminer.code_type option.

lookup_version

character. Version of the lookup table to use. Default: "latest". Can be configured through the codeminer.lookup_version option.

ignore_case

If TRUE (default), ignore case in description.

preferred_description_only

logical. If TRUE (default), return only preferred descriptions.

col_filters

Column filters to apply. See CODES() for details.

Value

A codeminer_codelist with codes that match the description.

Examples

# build dummy database
create_dummy_database()
#>  Dummy database ready to use!
#>  To reconnect to your previous database:
#>   `Sys.setenv(CODEMINER_DB_PATH = "/tmp/RtmpXyzdMY/file19d42b2b31a3.duckdb")`
#>   `codeminer_connect()`

# lookup ICD10 code descriptions matching 'cyst'
DESCRIPTION("cyst", type = "ICD-10")
#>  Using 'UKB v4' as latest version
#> <codeminer_codelist>: 2 codes
#> Code type: "ICD-10"
#> 
#> # A tibble: 2 × 3
#>   code  description          code_type
#>   <chr> <chr>                <chr>    
#> 1 L721  Trichilemmal cyst    ICD-10   
#> 2 N330  Tuberculous cystitis ICD-10