diff --git a/DESCRIPTION b/DESCRIPTION index 4eff74ec..d1fa2d08 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 (), diff --git a/R/geoflow_handler.R b/R/geoflow_handler.R index 7d165175..4e5cd0b5 100644 --- a/R/geoflow_handler.R +++ b/R/geoflow_handler.R @@ -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 @@ -57,8 +61,11 @@ 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 @@ -66,6 +73,8 @@ geoflow_handler <- R6Class("geoflow_handler", 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, diff --git a/R/geoflow_handler_contact.R b/R/geoflow_handler_contact.R index dec73441..6c1ada32 100644 --- a/R/geoflow_handler_contact.R +++ b/R/geoflow_handler_contact.R @@ -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 )) })) diff --git a/R/geoflow_handler_dictionary.R b/R/geoflow_handler_dictionary.R index 36b8cd70..058b83d7 100644 --- a/R/geoflow_handler_dictionary.R +++ b/R/geoflow_handler_dictionary.R @@ -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 )) })) diff --git a/R/geoflow_handler_entity.R b/R/geoflow_handler_entity.R index 3d8f205c..5305fd8e 100644 --- a/R/geoflow_handler_entity.R +++ b/R/geoflow_handler_entity.R @@ -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", @@ -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", @@ -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", @@ -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 )) })) diff --git a/README.md b/README.md index 4748cf2f..11f37137 100644 --- a/README.md +++ b/README.md @@ -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** diff --git a/inst/metadata/entity/entity_handler_csv.R b/inst/metadata/entity/entity_handler_csv.R index bb37811c..69b888f5 100644 --- a/inst/metadata/entity/entity_handler_csv.R +++ b/inst/metadata/entity/entity_handler_csv.R @@ -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) } \ No newline at end of file diff --git a/inst/metadata/entity/entity_handler_excel.R b/inst/metadata/entity/entity_handler_excel.R index 1bd42e3d..349e3899 100644 --- a/inst/metadata/entity/entity_handler_excel.R +++ b/inst/metadata/entity/entity_handler_excel.R @@ -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) } \ No newline at end of file diff --git a/inst/metadata/entity/entity_handler_gsheet.R b/inst/metadata/entity/entity_handler_gsheet.R index 819933ff..cbc69ddb 100644 --- a/inst/metadata/entity/entity_handler_gsheet.R +++ b/inst/metadata/entity/entity_handler_gsheet.R @@ -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) } \ No newline at end of file