Load source_to_concept_map table from Usagi mapping Files.
Source:R/load_source_to_concept_map.R
load_source_to_concept_map.Rd
This function loads the source_to_concept_map table using the mapping files created with the OHDSI Usagi (https://github.com/OHDSI/Usagi) application.
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
stcm <- load_source_to_concept_map()
#> Loading source_to_concept_map table...
#> Connecting using PostgreSQL driver
#> Deleting all records from table: source_to_concept_map
#> Executing SQL took 0.0345 secs
#> Reading vocabulary_id from concept vocabulary...
#> Processing Usagi mapping files...
#> - admissions_gender
#> * 'AUMC Gender' for MAPS_TO mapping
#> - admissions_origin
#> * 'AUMC Origin' for MAPS_TO mapping
#> - admissions_destination
#> * 'AUMC Destination' for MAPS_TO mapping
#> - admissions_specialty
#> * 'AUMC Specialty' for MAPS_TO mapping
#> - drugitems_administeredunit
#> * 'AUMC Unit' for MAPS_TO mapping
#> - drugitems_item
#> * 'AUMC Drug' for MAPS_TO mapping
#> * 'AUMC Drug Route' for MAPS_TO_TYPE mapping
#> - drugitems_ordercategory
#> * 'AUMC Route' for MAPS_TO mapping
#> - freetextitems_item
#> * 'AUMC Text' for MAPS_TO mapping
#> - freetextitems_value
#> * 'AUMC Text Value' for MAPS_TO mapping
#> - listitems_item
#> * 'AUMC List' for MAPS_TO mapping
#> * 'AUMC Qualifier' for MAPS_TO_TYPE mapping
#> - listitems_meas_value
#> * 'AUMC Meas Value' for MAPS_TO mapping
#> * 'AUMC List Unit' for MAPS_TO_UNIT mapping
#> - listitems_obs_value
#> * 'AUMC Obs Value' for MAPS_TO mapping
#> * 'AUMC List Unit' for MAPS_TO_UNIT mapping
#> * 'AUMC Qualifier' for MAPS_TO_TYPE mapping
#> - listitems_device
#> * 'AUMC Device' for MAPS_TO mapping
#> - listitems_procedure
#> * 'AUMC Procedure' for MAPS_TO mapping
#> - listitems_condition
#> * 'AUMC Condition' for MAPS_TO mapping
#> - numericitems_lab
#> * 'AUMC Laboratory' for MAPS_TO mapping
#> * 'AUMC Numeric Unit' for MAPS_TO_UNIT mapping
#> - numericitems_other
#> * 'AUMC Numeric' for MAPS_TO mapping
#> * 'AUMC Numeric Unit' for MAPS_TO_UNIT mapping
#> - numericitems_tag
#> * 'AUMC Tag' for MAPS_TO mapping
#> - numericitems_unit
#> * 'AUMC Unit' for MAPS_TO mapping
#> - procedureorderitems_item
#> * 'AUMC Procedure Order' for MAPS_TO mapping
#> * 'AUMC Qualifier' for MAPS_TO_TYPE mapping
#> - processitems_item
#> * 'AUMC Process' for MAPS_TO mapping
#> * 'AUMC Anatomic Site' for MAPS_TO_VALUE mapping
#> - providers
#> * 'AUMC Provider' for MAPS_TO mapping
#> - reason_for_admission
#> * 'AUMC Diagnosis' for MAPS_TO mapping
#> - specimen_source
#> * 'AUMC Specimen Source' for MAPS_TO mapping
#> Saving source_to_concept_map.csv in mappings folder...
#> Loading mapping records into table: source_to_concept_map
#> Inserting data took 1.73 secs
#> Loading source_to_value_map table...
#> Connecting using PostgreSQL driver
#> Deleting source_to_value_map table: source_to_value_map
#> Executing SQL took 0.0235 secs
#> Creating source_to_value_map table: source_to_value_map
#> Executing SQL took 0.0112 secs
#> Loading mapping records into table: source_to_value_map
#> Inserting data took 0.0261 secs
#> Success: source_to_value_map loaded.
#> Success: source_to_concept_map loaded.
stcm
#> # A tibble: 9,907 × 9
#> source_code source_concept_id source_vocabulary_id source_code_descript…¹
#> <chr> <dbl> <chr> <chr>
#> 1 Vrouw 0 AUMC Gender Vrouw
#> 2 Man 0 AUMC Gender Man
#> 3 Huis 0 AUMC Origin Huis
#> 4 CCU/IC zelfde … 0 AUMC Origin CCU/IC zelfde ziekenh…
#> 5 Eerste Hulp af… 0 AUMC Origin Eerste Hulp afdeling …
#> 6 Recovery ander… 0 AUMC Origin Recovery ander zieken…
#> 7 Eerste Hulp af… 0 AUMC Origin Eerste Hulp afdeling …
#> 8 Operatiekamer … 0 AUMC Origin Operatiekamer vanaf v…
#> 9 Special/Medium… 0 AUMC Origin Special/Medium care a…
#> 10 Operatiekamer … 0 AUMC Origin Operatiekamer vanaf E…
#> # ℹ 9,897 more rows
#> # ℹ abbreviated name: ¹source_code_description
#> # ℹ 5 more variables: target_concept_id <dbl>, target_vocabulary_id <chr>,
#> # valid_start_date <date>, valid_end_date <date>, invalid_reason <lgl>