Load source_to_value_map table from SQL file.
Source:R/load_source_to_value_map.R
load_source_to_value_map.Rd
Since Usagi removes mappings to invalid concepts on loading
(e.g. after importing a new vocabulary with deprecated concepts),
our previous method to store quantities for Drug and other domains will
fail since many numeric concepts have been deprecated.
This function will load migrated quantity data from the
insert_source_to_value_map.sql
file to the new source_to_value table.
Details
This function requires a configured config.yaml
file created using
amstel::create_config()
. It will use the connection configuration specified
in the cdm
section to load the source_to_concept tables in the CDM by reading the
Usagi csv files in the mappings
folder.
This function assumes amstel::create_cdm_tables()
and
amstel::load_vocabulary_tables()
have already been run.
Examples
load_source_to_value_map()
#> Loading source_to_value_map table...
#> Connecting using PostgreSQL driver
#> Deleting source_to_value_map table: source_to_value_map
#> Executing SQL took 0.0201 secs
#> Creating source_to_value_map table: source_to_value_map
#> Executing SQL took 0.0122 secs
#> Loading mapping records into table: source_to_value_map
#> Inserting data took 0.0293 secs
#> Success: source_to_value_map loaded.
#> # A tibble: 55 × 6
#> SOURCE_CODE SOURCE_CONCEPT_ID SOURCE_VOCABULARY_ID SOURCE_CODE_DESCRIPTION
#> <chr> <dbl> <chr> <chr>
#> 1 13169-21 0 AUMC Drug Quantity SDD pasta Tracheostoma (8…
#> 2 13169-21 0 AUMC Drug Quantity SDD pasta Tracheostoma (8…
#> 3 13169-21 0 AUMC Drug Quantity SDD pasta Tracheostoma (8…
#> 4 13170-21 0 AUMC Drug Quantity SDD pasta Tracheostoma (6…
#> 5 13170-21 0 AUMC Drug Quantity SDD pasta Tracheostoma (6…
#> 6 13170-21 0 AUMC Drug Quantity SDD pasta Tracheostoma (6…
#> 7 13171-21 0 AUMC Drug Quantity SDD pasta Tracheostoma (4…
#> 8 13171-21 0 AUMC Drug Quantity SDD pasta Tracheostoma (4…
#> 9 13171-21 0 AUMC Drug Quantity SDD pasta Tracheostoma (4…
#> 10 13457-21 0 AUMC Drug Quantity SDD Suppositorium
#> # ℹ 45 more rows
#> # ℹ 2 more variables: VALUE <dbl>, ROW <dbl>