Generate the required metadata for a lookup table. This is mainly used to
generate the necessary metadata when adding a new lookup table to the database
with add_lookup_table().
Usage
lookup_metadata(
code_type,
lookup_version = "v0",
...,
lookup_code_col = "code",
lookup_description_col = "description",
lookup_source = NA_character_,
preferred_description_col = NA_character_,
preferred_description_indicator = NA_character_,
col_filters = NULL
)Arguments
- code_type
The type of coding system (e.g., ICD-10, SNOMED-CT)
- lookup_version
The version of the lookup metadata (default: "v0")
- ...
These dots are for future extensions and must be empty.
- lookup_code_col
The column name for the lookup code (default: "code")
- lookup_description_col
The column name for the lookup description (default: "description")
- lookup_source
The source of the lookup metadata (default:
NA_character_)- preferred_description_col
The name of the column that indicates the preferred description. This is useful for lookup tables that have multiple descriptions for the same code (default:
NA_character_).- preferred_description_indicator
The value in the
preferred_description_colcolumn that indicates the preferred description (default:NA_character_)- col_filters
Optional column filter specification. A named list where each element is a list with
values(all valid values) anddefaults(default filter values). See Details for the format.NULL(default) means no column filters.
Details
The col_filters argument specifies which columns in the lookup table are
filterable and what the default filter values are. The format is:
When col_filters is set, query functions like CODES() will automatically
filter the lookup table to only include rows matching the default values.
Examples
lookup_metadata("ICD-10", lookup_version = "2023")
#> $lookup_table_name
#> [1] "ICD-10_2023"
#>
#> $code_type
#> [1] "ICD-10"
#>
#> $lookup_version
#> [1] "2023"
#>
#> $lookup_code_col
#> [1] "code"
#>
#> $lookup_description_col
#> [1] "description"
#>
#> $lookup_source
#> [1] NA
#>
#> $preferred_description_col
#> [1] NA
#>
#> $preferred_description_indicator
#> [1] NA
#>
#> $col_filters
#> [1] NA
#>