Skip to contents

Saves the concepts list into the source_concepts folder

Usage

save_concepts(concepts, concept_group, force = FALSE)

Arguments

concepts

tibble containing the concepts

concept_group

concept group name that will be used to create the file name

force

forces overwriting file. WARNING: this may delete already mapped concepts

Value

(unmodified) tibble containing the concepts

Examples

library(dplyr)
conn <- amstel::connect("amsterdamumcdb")
#> Connecting using PostgreSQL driver
#> Executing SQL took 0.00366 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 <- save_concepts(concepts, "admissions_origin")
#> 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 × 2
#>    source_concept                                                  count
#>    <chr>                                                           <dbl>
#>  1 Special/Medium care zelfde ziekenhuis                             193
#>  2 NA                                                              14075
#>  3 Andere locatie zelfde ziekenhuis, transport per ambulance           5
#>  4 Verpleegafdeling ander ziekenhuis                                  91
#>  5 Verpleegafdeling zelfde ziekenhuis                               5027
#>  6 Operatiekamer vanaf Eerste Hulp afdeling zelfde ziekenhuis          2
#>  7 Recovery zelfde ziekenhuis (alleen bij niet geplande IC-opname)   217
#>  8 Special/Medium care ander ziekenhuis                               19
#>  9 CCU/IC ander ziekenhuis                                           239
#> 10 Anders                                                             53
#> 11 Eerste Hulp afdeling ander ziekenhuis                             132
#> 12 CCU/IC zelfde ziekenhuis                                          296
#> 13 Huis                                                               85
#> 14 Recovery ander ziekenhuis                                           6
#> 15 Operatiekamer vanaf verpleegafdeling zelfde ziekenhuis              5
#> 16 Eerste Hulp afdeling zelfde ziekenhuis                           2661