Skip to content

Commit 5371257

Browse files
committed
#387 manage record communities
1 parent 906cc16 commit 5371257

File tree

3 files changed

+30
-9
lines changed

3 files changed

+30
-9
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: geoflow
2-
Version: 0.20240520
3-
Date: 2024-05-20
2+
Version: 0.20240524
3+
Date: 2024-05-24
44
Title: Tools to Orchestrate Geospatial (Meta)Data Management Workflows and Manage FAIR Services
55
Description: An engine to facilitate the orchestration and execution of metadata-driven data management workflows, in compliance with FAIR
66
(Findable, Accessible, Interoperable and Reusable) data management principles. By means of a pivot metadata model, relying on the DublinCore standard (<https://dublincore.org/>),

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![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)
44
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/geoflow)](https://cran.r-project.org/package=geoflow)
5-
[![Github_Status_Badge](https://img.shields.io/badge/Github-0.20240520-blue.svg)](https://github.com/r-geoflow/geoflow)
5+
[![Github_Status_Badge](https://img.shields.io/badge/Github-0.20240524-blue.svg)](https://github.com/r-geoflow/geoflow)
66
[![DOI](https://zenodo.org/badge/DOI//10.5281/zenodo.3138920.svg)](https://doi.org//10.5281/zenodo.3138920)
77

88
**R engine to orchestrate and run (meta)data workflows**

inst/actions/zen4R_deposit_record.R

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,6 @@ function(action, entity, config){
332332
}
333333
}
334334

335-
#communities
336-
#TODO to analyze if this can be done with new Zenodo API
337-
# if(length(communities)>0){
338-
# zenodo_metadata$metadata$communities <- list()
339-
# for(community in communities) if(!is.na(community)) zenodo_metadata$addCommunity(community, sandbox = ZENODO$sandbox)
340-
# }
341335
}else{
342336
config$logger.info("Skipping update of Zenodo record metadata (option 'update_metadata' FALSE)")
343337
}
@@ -499,6 +493,33 @@ function(action, entity, config){
499493
errMsg <- sprintf("Zenodo: %s", out$errors[[1]]$message)
500494
config$logger.error(errMsg)
501495
stop(errMsg)
496+
}else{
497+
#business logic for communities
498+
#check that record is not yet associated to community
499+
#If ok, then check there is no pending request
500+
#If ok, we submit it to the community
501+
#If the geoflow user is maintainer of this community, make possible to accept immediatly the record
502+
if(length(communities)>0){
503+
for(community in communities){
504+
config$logger.info(sprintf("-> Processing community %s", community))
505+
zen_com = ZENODO$getCommunityById(community)
506+
#we check the comunity exists
507+
if(!is.null(zen_com)){
508+
#we check if the record is already in community
509+
rec_coms = ZENODO$getRecordCommunities(out)
510+
has_com = FALSE
511+
if(length(rec_coms)>0) has_com = any(sapply(rec_coms, function(x){x$id == zen_com$id}))
512+
if(!has_com){
513+
#if record is not in community we check pending requests
514+
pending_reqs = ZENODO$getRequests(q = sprintf("status:submitted AND receiver.community:%s AND topic.record:%s", zen_com$id, out$id))
515+
if(length(pending_reqs)==0){
516+
ZENODO$submitToCommunities(record, communities = community)
517+
#TODO in case the geoflow user is manager for the community, give action option to accept it immediatly
518+
}
519+
}
520+
}
521+
}
522+
}
502523
}
503524

504525
#we set the (prereserved) doi to the entity in question

0 commit comments

Comments
 (0)