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,
meta = 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.- meta
Optional pre-resolved mapping metadata row (as returned by the internal metadata resolver). When supplied, the metadata is not resolved again - callers that have already resolved it pass it through to avoid repeating the resolution (and any reverse-swap warning it emits). Defaults to
NULL, which resolves the metadata fromfrom/to/map_version.- 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(),
CODES_ALL_CHUNK(),
CODES_LIKE_CHUNK(),
DESCRIPTION_CHUNK(),
MAP(),
get_lookup_table(),
get_relationship_table(),
get_relationship_tree()
Examples
create_dummy_database()
#> ✔ Dummy database ready to use!
#> ℹ To reconnect to your previous database:
#> `Sys.setenv(CODEMINER_DB_PATH = "/tmp/Rtmp2UzWkJ/file1c053ce71eae.duckdb")`
#> `codeminer_connect()`
# Get the full Read 3 to ICD-10 mapping table
get_mapping_table("Read v3", "ICD-10") |> dplyr::collect()
#> ℹ Using "UKB v4" as the latest mapping version for "Read v3 > ICD-10".
#> # 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>