Skip to content

Commit

Permalink
support #386
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed May 13, 2024
1 parent deabaa3 commit 736131d
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 14 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: geoflow
Version: 0.20240502
Date: 2024-05-02
Version: 0.20240513
Date: 2024-05-13
Title: Tools to Orchestrate Geospatial (Meta)Data Management Workflows and Manage FAIR Services
Description: An engine to facilitate the orchestration and execution of metadata-driven data management workflows, in compliance with FAIR
(Findable, Accessible, Interoperable and Reusable) data management principles. By means of a pivot metadata model, relying on the DublinCore standard (<https://dublincore.org/>),
Expand Down
11 changes: 10 additions & 1 deletion R/geoflow_handler.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ geoflow_handler <- R6Class("geoflow_handler",
options = list(),
#'@field available_options available options
available_options = list(),
#'@field status status
status = "active",
#'@field notes notes
notes = "",

#'@description Initializes a \link{geoflow_handler}
#'@param id id
Expand All @@ -57,15 +61,20 @@ geoflow_handler <- R6Class("geoflow_handler",
#'@param script a handler script
#'@param options action options
#'@param available_options available options for the action
#'@param status status (active/deprecated)
#'@param notes notes
initialize = function(id, def = "", packages = list(), fun = NULL, script = NULL,
options = list(), available_options = list()){
options = list(), available_options = list(),
status = "active", notes = ""){
self$id <- id
self$def <- def
self$packages <- packages
self$fun <- fun
self$script <- script
self$options <- options
self$available_options <- available_options
self$status = status
self$notes = notes
},

#'@description Check that all packages required for the handler are available, if yes,
Expand Down
2 changes: 2 additions & 0 deletions R/geoflow_handler_contact.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ list_contact_handlers <- function(raw = FALSE){
id = handler$id,
definition = handler$def,
packages = paste(handler$packages, collapse=","),
status = handler$status,
notes = handler$notes,
stringsAsFactors = FALSE
))
}))
Expand Down
2 changes: 2 additions & 0 deletions R/geoflow_handler_dictionary.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ list_dictionary_handlers <- function(raw = FALSE){
id = handler$id,
definition = handler$def,
packages = paste(handler$packages, collapse=","),
status = handler$status,
notes = handler$notes,
stringsAsFactors = FALSE
))
}))
Expand Down
32 changes: 25 additions & 7 deletions R/geoflow_handler_entity.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,27 @@ register_entity_handlers <- function(){
def = "Handle metadata entities from a CSV file",
fun = source(system.file("metadata/entity", "entity_handler_csv.R", package = "geoflow"))$value,
available_options = list(
guess_max = list(def = "Guess max argument, see readr::read_csv", default = 0)
guess_max = list(def = "Guess max argument, see readr::read_csv", default = 0),
enrich_from_dbi = list(def = "Enrich entity data from DBI software", default = FALSE)
)
),
geoflow_handler$new(
id = "excel",
def = "Handle metadata entities from a Microsoft Excel (xls,xlsx) file",
packages = list("readxl"),
fun = source(system.file("metadata/entity", "entity_handler_excel.R", package = "geoflow"))$value
fun = source(system.file("metadata/entity", "entity_handler_excel.R", package = "geoflow"))$value,
available_options = list(
enrich_from_dbi = list(def = "Enrich entity data from DBI software", default = FALSE)
)
),
geoflow_handler$new(
id = "gsheet",
def = "Handle metadata entities from a Google spreadsheet",
packages = list("gsheet"),
fun = source(system.file("metadata/entity", "entity_handler_gsheet.R", package = "geoflow"))$value
fun = source(system.file("metadata/entity", "entity_handler_gsheet.R", package = "geoflow"))$value,
available_options = list(
enrich_from_dbi = list(def = "Enrich entity data from DBI software", default = FALSE)
)
),
geoflow_handler$new(
id = "dbi",
Expand All @@ -42,19 +49,25 @@ register_entity_handlers <- function(){
id = "dbi_csv",
def = "Handle DBI metadata entities from a CSV file",
packages = list("DBI", "RSQLite", "RPostgres"),
fun = source(system.file("metadata/entity", "entity_handler_dbi_csv.R", package = "geoflow"))$value
fun = source(system.file("metadata/entity", "entity_handler_dbi_csv.R", package = "geoflow"))$value,
status = "deprecated",
notes = "Use 'csv' handler enabling option 'enrich_from_dbi"
),
geoflow_handler$new(
id = "dbi_excel",
def = "Handle DBI metadata entities from a Microsoft Excel (xls, xlsx) file",
packages = list("readxl"),
fun = source(system.file("metadata/entity", "entity_handler_dbi_excel.R", package = "geoflow"))$value
fun = source(system.file("metadata/entity", "entity_handler_dbi_excel.R", package = "geoflow"))$value,
status = "deprecated",
notes = "Use 'excel' handler enabling option 'enrich_from_dbi"
),
geoflow_handler$new(
id = "dbi_gsheet",
def = "Handle DBI metadata entities from a Google spreadsheet",
packages = list("gsheet"),
fun = source(system.file("metadata/entity", "entity_handler_dbi_gsheet.R", package = "geoflow"))$value
fun = source(system.file("metadata/entity", "entity_handler_dbi_gsheet.R", package = "geoflow"))$value,
status = "deprecated",
notes = "Use 'gsheet' handler enabling option 'enrich_from_dbi"
),
geoflow_handler$new(
id = "dataverse",
Expand All @@ -66,7 +79,10 @@ register_entity_handlers <- function(){
id = "ocs",
def = "Handle metadata entities from a tabulat data source (csv or excel) hosted on an OCS cloud",
packages = list("ocs4R"),
fun = source(system.file("metadata/entity", "entity_handler_ocs.R", package = "geoflow"))$value
fun = source(system.file("metadata/entity", "entity_handler_ocs.R", package = "geoflow"))$value,
available_options = list(
enrich_from_dbi = list(def = "Enrich entity data from DBI software", default = FALSE)
)
),
geoflow_handler$new(
id = "ncdf",
Expand Down Expand Up @@ -151,6 +167,8 @@ list_entity_handlers <- function(raw = FALSE){
id = handler$id,
definition = handler$def,
packages = paste(handler$packages, collapse=","),
status = handler$status,
notes = handler$notes,
stringsAsFactors = FALSE
))
}))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://github.com/r-geoflow/geoflow/actions/workflows/r-cmd-check.yml/badge.svg?branch=master)](https://github.com/r-geoflow/geoflow/actions/workflows/r-cmd-check.yml)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/geoflow)](https://cran.r-project.org/package=geoflow)
[![Github_Status_Badge](https://img.shields.io/badge/Github-0.20240502-blue.svg)](https://github.com/r-geoflow/geoflow)
[![Github_Status_Badge](https://img.shields.io/badge/Github-0.202405013-blue.svg)](https://github.com/r-geoflow/geoflow)
[![DOI](https://zenodo.org/badge/DOI//10.5281/zenodo.3138920.svg)](https://doi.org//10.5281/zenodo.3138920)

**R engine to orchestrate and run (meta)data workflows**
Expand Down
3 changes: 2 additions & 1 deletion inst/metadata/entity/entity_handler_csv.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ handle_entities_csv <- function(handler, source, config, handle = TRUE){
if(!handle) return(source)

#apply generic handler
handle_entities_df <- source(system.file("metadata/entity", "entity_handler_df.R", package = "geoflow"))$value
handler_script = if(handler$getOption("enrich_from_dbi")) "entity_handler_dbi_df.R" else "entity_handler_df.R"
handle_entities_df <- source(system.file("metadata/entity", handler_script, package = "geoflow"))$value
entities <- handle_entities_df(handler, source, config)
return(entities)
}
3 changes: 2 additions & 1 deletion inst/metadata/entity/entity_handler_excel.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ handle_entities_excel <- function(handler, source, config, handle = TRUE){
if(!handle) return(source)

#apply generic handler
handle_entities_df <- source(system.file("metadata/entity", "entity_handler_df.R", package = "geoflow"))$value
handler_script = if(handler$getOption("enrich_from_dbi")) "entity_handler_dbi_df.R" else "entity_handler_df.R"
handle_entities_df <- source(system.file("metadata/entity", handler_script, package = "geoflow"))$value
entities <- handle_entities_df(handler, source, config)
return(entities)
}
3 changes: 2 additions & 1 deletion inst/metadata/entity/entity_handler_gsheet.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ handle_entities_gsheet <- function(handler, source, config, handle = TRUE){
if(!handle) return(source)

#apply generic handler
handle_entities_df <- source(system.file("metadata/entity", "entity_handler_df.R", package = "geoflow"))$value
handler_script = if(handler$getOption("enrich_from_dbi")) "entity_handler_dbi_df.R" else "entity_handler_df.R"
handle_entities_df <- source(system.file("metadata/entity", handler_script, package = "geoflow"))$value
entities <- handle_entities_df(handler, source, config)
return(entities)
}

0 comments on commit 736131d

Please sign in to comment.