Skip to contents

Returns a lazy dplyr::tbl() containing the mapping table with standardised column names (from, to) plus all additional columns from the underlying database table. Call dplyr::collect() to materialise the result.

Usage

get_mapping_table(
  from,
  to,
  map_version = "latest",
  col_filters = "default",
  con = NULL,
  call = rlang::caller_env()
)

Arguments

from

The source code type to map from.

to

The target code type to map to.

map_version

The version to retrieve. Defaults to "latest".

col_filters

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

con

Optional DBI connection. If NULL (default), uses the workbench connection.

call

The calling environment. Passed to codeminer_abort.

Value

A lazy dplyr::tbl() with standardised columns (from, to) plus all other columns from the underlying table.

Details

This is useful for inspecting columns beyond the standard codelist output returned by MAP().

See also

MAP() for standardised codelist output, get_codeminer_metadata() for discovering available tables.

Other Clinical code lookups and mappings: CODES(), MAP(), get_lookup_table(), get_relationship_table()

Examples

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

# Get the full Read 3 to ICD-10 mapping table
get_mapping_table("Read 3", "ICD-10") |> dplyr::collect()
#>  Using 'UKB v4' as latest version
#> # A tibble: 5 × 8
#>   from  to    mapping_status refine_flag add_code_flag element_num block_num
#>   <chr> <chr> <chr>          <chr>       <chr>         <chr>       <chr>    
#> 1 X40J4 E109  D              C           P             0           0        
#> 2 C10.. E149  D              C           C             0           0        
#> 3 XaIP9 L721  D              C           C             0           0        
#> 4 XE0e0 N390  D              C           P             0           0        
#> 5 XE0Uc I10   D              C           C             0           0        
#> # ℹ 1 more variable: icd10_dagger_asterisk <chr>