|
11 | 11 | #' @export
|
12 | 12 | #'
|
13 | 13 | register_dictionary_handlers <- function(){
|
14 |
| - handlers <- list( |
15 |
| - geoflow_handler$new( |
16 |
| - id = "csv", |
17 |
| - def = "Handle dictionary from a CSV file", |
18 |
| - fun = source(system.file("metadata/dictionary", "dictionary_handler_csv.R", package = "geoflow"))$value |
19 |
| - ), |
20 |
| - geoflow_handler$new( |
21 |
| - id = "excel", |
22 |
| - def = "Handle dictionary from a Microsoft Excel (xls,xlsx) file", |
23 |
| - packages = list("readxl"), |
24 |
| - fun = source(system.file("metadata/dictionary", "dictionary_handler_excel.R", package = "geoflow"))$value |
25 |
| - ), |
26 |
| - geoflow_handler$new( |
27 |
| - id = "gsheet", |
28 |
| - def = "Handle dictionary from a Google spreadsheet", |
29 |
| - packages = list("gsheet"), |
30 |
| - fun = source(system.file("metadata/dictionary", "dictionary_handler_gsheet.R", package = "geoflow"))$value |
31 |
| - ), |
32 |
| - geoflow_handler$new( |
33 |
| - id = "dbi", |
34 |
| - def = "Handle dictionary from a DB source", |
35 |
| - packages = list("DBI", "RSQLite", "RPostgres"), |
36 |
| - fun = source(system.file("metadata/dictionary", "dictionary_handler_dbi.R", package = "geoflow"))$value |
37 |
| - ), |
38 |
| - geoflow_handler$new( |
39 |
| - id = "ocs", |
40 |
| - def = "Handle dictionary from a tabulat data source (csv or excel) hosted on an OCS cloud", |
41 |
| - packages = list("ocs4R"), |
42 |
| - fun = source(system.file("metadata/dictionary", "dictionary_handler_ocs.R", package = "geoflow"))$value |
43 |
| - ) |
44 |
| - ) |
| 14 | + yml_files = list.files(system.file("metadata/dictionary", package = "geoflow"), pattern = "yml") |
| 15 | + handlers <- lapply(yml_files, function(file){ |
| 16 | + geoflow_handler$new(yaml = system.file("metadata/dictionary", file, package = "geoflow")) |
| 17 | + }) |
45 | 18 | .geoflow$dictionary_handlers <- handlers
|
46 | 19 | }
|
47 | 20 |
|
|
0 commit comments