diff --git a/DESCRIPTION b/DESCRIPTION index 61c0150..f3b2610 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: geoflow -Version: 0.20240520 -Date: 2024-05-20 +Version: 0.20240524 +Date: 2024-05-24 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/README.md b/README.md index a4bff91..164a642 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.20240520-blue.svg)](https://github.com/r-geoflow/geoflow) +[![Github_Status_Badge](https://img.shields.io/badge/Github-0.20240524-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/actions/zen4R_deposit_record.R b/inst/actions/zen4R_deposit_record.R index 1b6ef63..c86b4ce 100644 --- a/inst/actions/zen4R_deposit_record.R +++ b/inst/actions/zen4R_deposit_record.R @@ -332,12 +332,6 @@ function(action, entity, config){ } } - #communities - #TODO to analyze if this can be done with new Zenodo API - # if(length(communities)>0){ - # zenodo_metadata$metadata$communities <- list() - # for(community in communities) if(!is.na(community)) zenodo_metadata$addCommunity(community, sandbox = ZENODO$sandbox) - # } }else{ config$logger.info("Skipping update of Zenodo record metadata (option 'update_metadata' FALSE)") } @@ -499,6 +493,33 @@ function(action, entity, config){ errMsg <- sprintf("Zenodo: %s", out$errors[[1]]$message) config$logger.error(errMsg) stop(errMsg) + }else{ + #business logic for communities + #check that record is not yet associated to community + #If ok, then check there is no pending request + #If ok, we submit it to the community + #If the geoflow user is maintainer of this community, make possible to accept immediatly the record + if(length(communities)>0){ + for(community in communities){ + config$logger.info(sprintf("-> Processing community %s", community)) + zen_com = ZENODO$getCommunityById(community) + #we check the comunity exists + if(!is.null(zen_com)){ + #we check if the record is already in community + rec_coms = ZENODO$getRecordCommunities(out) + has_com = FALSE + if(length(rec_coms)>0) has_com = any(sapply(rec_coms, function(x){x$id == zen_com$id})) + if(!has_com){ + #if record is not in community we check pending requests + pending_reqs = ZENODO$getRequests(q = sprintf("status:submitted AND receiver.community:%s AND topic.record:%s", zen_com$id, out$id)) + if(length(pending_reqs)==0){ + ZENODO$submitToCommunities(record, communities = community) + #TODO in case the geoflow user is manager for the community, give action option to accept it immediatly + } + } + } + } + } } #we set the (prereserved) doi to the entity in question