Skip to content

Commit 972a068

Browse files
committed
#403 dictionary handlers
1 parent d48f7cf commit 972a068

6 files changed

+86
-31
lines changed

R/geoflow_handler_dictionary.R

+4-31
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,10 @@
1111
#' @export
1212
#'
1313
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+
})
4518
.geoflow$dictionary_handlers <- handlers
4619
}
4720

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
id: csv
2+
type: dictionary
3+
fun: dictionary_handler_csv.R
4+
funders: []
5+
authors:
6+
- name: Emmanuel Blondel
7+
8+
maintainer:
9+
name: Emmanuel Blondel
10+
11+
def: Handle dictionary from a CSV file
12+
status: stable
13+
packages:
14+
- readr
15+
available_options: []
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
id: dbi
2+
type: dictionary
3+
fun: dictionary_handler_dbi.R
4+
funders: []
5+
authors:
6+
- name: Emmanuel Blondel
7+
8+
maintainer:
9+
name: Emmanuel Blondel
10+
11+
def: Handle dictionary from a DB source
12+
status: stable
13+
packages:
14+
- DBI
15+
- RSQLite
16+
- RPostgres
17+
- RPostgreSQL
18+
available_options: []
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
id: excel
2+
type: dictionary
3+
fun: dictionary_handler_excel.R
4+
funders: []
5+
authors:
6+
- name: Emmanuel Blondel
7+
8+
maintainer:
9+
name: Emmanuel Blondel
10+
11+
def: Handle dictionary from a Microsoft Excel (xls,xlsx) file
12+
status: stable
13+
packages:
14+
- readxl
15+
available_options: []
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
id: gsheet
2+
type: dictionary
3+
fun: dictionary_handler_gsheet.R
4+
funders: []
5+
authors:
6+
- name: Emmanuel Blondel
7+
8+
maintainer:
9+
name: Emmanuel Blondel
10+
11+
def: Handle dictionary from a Google spreadsheet
12+
status: stable
13+
packages:
14+
- gsheet
15+
available_options: []
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
id: ocs
2+
type: dictionary
3+
fun: dictionary_handler_ocs.R
4+
funders:
5+
- name: INRAE
6+
url: https://www.inrae.fr
7+
authors:
8+
- name: Emmanuel Blondel
9+
10+
maintainer:
11+
name: Emmanuel Blondel
12+
13+
def: Handle dictionary from a tabulat data source (csv or excel) hosted on an OCS cloud
14+
status: stable
15+
packages:
16+
- ocs4R
17+
- rear
18+
- readxl
19+
available_options: []

0 commit comments

Comments
 (0)