Skip to content

Commit

Permalink
#403 contact handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Jan 6, 2025
1 parent 07724d0 commit d9d4fb0
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 31 deletions.
36 changes: 5 additions & 31 deletions R/geoflow_handler_contact.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,10 @@
#' @export
#'
register_contact_handlers <- function(){
handlers <- list(
geoflow_handler$new(
id = "csv",
def = "Handle metadata contacts from a CSV file",
fun = source(system.file("metadata/contact", "contact_handler_csv.R", package = "geoflow"))$value
),
geoflow_handler$new(
id = "excel",
def = "Handle metadata contacts from a Microsoft Excel (xls,xlsx) file",
packages = list("readxl"),
fun = source(system.file("metadata/contact", "contact_handler_excel.R", package = "geoflow"))$value
),
geoflow_handler$new(
id = "gsheet",
def = "Handle metadata contacts from a Google spreadsheet",
packages = list("gsheet"),
fun = source(system.file("metadata/contact", "contact_handler_gsheet.R", package = "geoflow"))$value
),
geoflow_handler$new(
id = "dbi",
def = "Handle metadata contacts from a DB source",
packages = list("DBI", "RSQLite", "RPostgres"),
fun = source(system.file("metadata/contact", "contact_handler_dbi.R", package = "geoflow"))$value
),
geoflow_handler$new(
id = "ocs",
def = "Handle metadata contacts from a tabulat data source (csv or excel) hosted on an OCS cloud",
packages = list("ocs4R"),
fun = source(system.file("metadata/contact", "contact_handler_ocs.R", package = "geoflow"))$value
)
)
yml_files = list.files(system.file("metadata/contact", package = "geoflow"), pattern = "yml")
handlers <- lapply(yml_files, function(file){
geoflow_handler$new(yaml = system.file("metadata/contact", file, package = "geoflow"))
})
.geoflow$contact_handlers <- handlers
}

Expand Down Expand Up @@ -73,6 +46,7 @@ list_contact_handlers <- function(raw = FALSE){
packages = paste(handler$packages, collapse=","),
status = handler$status,
notes = handler$notes,
maintainer = if(!is.null(handler$maintainer$name)){handler$maintainer$name}else{ if(handler$maintainer$orphaned) "<orphaned>" else "<unknown>" },
stringsAsFactors = FALSE
))
}))
Expand Down
19 changes: 19 additions & 0 deletions inst/metadata/contact/contact_handler_csv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
id: csv
type: contact
fun: contact_handler_csv.R
funders: []
authors:
- name: Emmanuel Blondel
email: [email protected]
maintainer:
name: Emmanuel Blondel
email: [email protected]
def: Handle metadata contacts from a CSV file
status: stable
packages:
- readr
available_options:
guess_max:
def: Guess max argument, see readr::read_csv
class: integer
default: 0
18 changes: 18 additions & 0 deletions inst/metadata/contact/contact_handler_dbi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
id: dbi
type: contact
fun: contact_handler_dbi.R
funders: []
authors:
- name: Emmanuel Blondel
email: [email protected]
maintainer:
name: Emmanuel Blondel
email: [email protected]
def: Handle metadata contacts from a DB source
status: stable
packages:
- DBI
- RSQLite
- RPostgres
- RPostgreSQL
available_options: []
15 changes: 15 additions & 0 deletions inst/metadata/contact/contact_handler_excel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
id: excel
type: contact
fun: contact_handler_excel.R
funders: []
authors:
- name: Emmanuel Blondel
email: [email protected]
maintainer:
name: Emmanuel Blondel
email: [email protected]
def: Handle metadata contacts from a Microsoft Excel (xls,xlsx) file
status: stable
packages:
- readxl
available_options: []
15 changes: 15 additions & 0 deletions inst/metadata/contact/contact_handler_gsheet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
id: gsheet
type: contact
fun: contact_handler_gsheet.R
funders: []
authors:
- name: Emmanuel Blondel
email: [email protected]
maintainer:
name: Emmanuel Blondel
email: [email protected]
def: Handle metadata contacts from a Google spreadsheet
status: stable
packages:
- gsheet
available_options: []
19 changes: 19 additions & 0 deletions inst/metadata/contact/contact_handler_ocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
id: ocs
type: contact
fun: contact_handler_ocs.R
funders:
- name: INRAE
url: https://www.inrae.fr
authors:
- name: Emmanuel Blondel
email: [email protected]
maintainer:
name: Emmanuel Blondel
email: [email protected]
def: Handle metadata contacts from a tabulat data source (csv or excel) hosted on an OCS cloud
status: stable
packages:
- ocs4R
- rear
- readxl
available_options: []

0 comments on commit d9d4fb0

Please sign in to comment.