Create source concept lists for mapping in OHDSI Usagi. Translates column_name into
English using the Google Translate Cloud API for matching using OHDSI Usagi.
Exports the tibble to the source_concepts
folder.
Arguments
- concepts
tibble containing concepts (column name: "source_concept") and the number of occurrences in the database (column name: "count") of those concepts.
- concept_group
Name this group of concepts should be called for extracting
- force
Forces overwriting an existing concept list. Default: FALSE.
Examples
library(dplyr)
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
conn <- amstel::connect("amsterdamumcdb")
#> Connecting using PostgreSQL driver
#> Executing SQL took 0.00359 secs
admissions <- tbl(conn, "admissions")
concepts <- admissions %>%
group_by(source_concept=origin) %>%
summarise(count=n()) %>%
collect()
#> Note: method with signature ‘DBIConnection#SQL’ chosen for function ‘dbQuoteIdentifier’,
#> target signature ‘DatabaseConnectorJdbcConnection#SQL’.
#> "DatabaseConnectorConnection#character" would also be valid
concepts <- extract_concepts(concepts, "admissions_origin")
#> 2024-05-14 22:17:08.150196 -- Translating text: NA characters -
#> WARNING: file already exists at: /home/patrick/git/AMSTEL/data/source_concepts/admissions_origin.csv
#> Concepts not extracted. Please delete the file if re-extraction is desired.
concepts
#> # A tibble: 16 × 3
#> source_concept count source_concept_en
#> <chr> <dbl> <chr>
#> 1 Special/Medium care zelfde ziekenhuis 193 Special/Medium c…
#> 2 NA 14075 NA
#> 3 Andere locatie zelfde ziekenhuis, transport per ambu… 5 Different locati…
#> 4 Verpleegafdeling ander ziekenhuis 91 Nursing departme…
#> 5 Verpleegafdeling zelfde ziekenhuis 5027 Nursing departme…
#> 6 Operatiekamer vanaf Eerste Hulp afdeling zelfde ziek… 2 Operating room f…
#> 7 Recovery zelfde ziekenhuis (alleen bij niet geplande… 217 Recovery same ho…
#> 8 Special/Medium care ander ziekenhuis 19 Special/Medium c…
#> 9 CCU/IC ander ziekenhuis 239 CCU/IC other hos…
#> 10 Anders 53 Otherwise
#> 11 Eerste Hulp afdeling ander ziekenhuis 132 Emergency depart…
#> 12 CCU/IC zelfde ziekenhuis 296 CCU/IC same hosp…
#> 13 Huis 85 House
#> 14 Recovery ander ziekenhuis 6 Recovery other h…
#> 15 Operatiekamer vanaf verpleegafdeling zelfde ziekenhu… 5 Operating room f…
#> 16 Eerste Hulp afdeling zelfde ziekenhuis 2661 Emergency depart…