Skip to content

Commit

Permalink
#24 document/list action options
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Oct 18, 2019
1 parent e731302 commit aa0cf20
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 13 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.0.9003
Date: 2019-10-18
Version: 0.0.9004
Date: 2019-10-19
Title: R engine to orchestrate and run geospatial (meta)data workflows
Authors@R: c(
person("Emmanuel", "Blondel", role = c("aut", "cre"), email = "emmanuel.blondel1@gmail.com", comment = c(ORCID = "0000-0002-5870-5762")),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export(handle_entities_excel)
export(handle_entities_gsheet)
export(initWorkflow)
export(initWorkflowJob)
export(list_action_options)
export(list_actions)
export(list_contact_handlers)
export(list_entity_handlers)
Expand Down
4 changes: 2 additions & 2 deletions R/geoflow.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#' \tabular{ll}{
#' Package: \tab geoflow\cr
#' Type: \tab Package\cr
#' Version: \tab 0.0.9003\cr
#' Date: \tab 2019-10-18\cr
#' Version: \tab 0.0.9004\cr
#' Date: \tab 2019-10-19\cr
#' License: \tab MIT\cr
#' LazyLoad: \tab yes\cr
#' }
Expand Down
49 changes: 45 additions & 4 deletions R/geoflow_action.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,30 @@ register_actions <- function(){
id = "geometa-create-iso-19115",
type = "Metadata production",
def = "Produce an ISO/OGC 19115/19139 metadata object",
fun = geometa_create_iso_19115
fun = geometa_create_iso_19115,
options = list(
doi = list(desc = "Add entity DOI - if defined - as metadata identifier and online resource", default = FALSE),
inspire = list(desc = "Validates ISO 19139 metadata with INSPIRE reference validator", default = FALSE),
logo = list(desc = "Add configure profile logo(s) - if defined - as metadata thumbnail(s)", default = FALSE)
)
),
geoflow_action$new(
id="ows4R-publish-iso-19139",
type = "Metadata publication",
def = "Publish/Update an ISO/OGC 19139 metadata object using OGC CSW Protocol",
fun = ows4R_publish_iso_19139
fun = ows4R_publish_iso_19139,
options = list(
geometa_inspire = list(desc = "Validates ISO 19139 metadata with INSPIRE reference validator before publication", default = FALSE)
)
),
geoflow_action$new(
id = "geonapi-publish-iso-19139",
type = "Metadata publication",
def = "Publish/Update an ISO/OGC 19139 metadata object with GeoNetwork API",
fun = geonapi_publish_iso_19139
fun = geonapi_publish_iso_19139,
options = list(
geometa_inspire = list(desc = "Validates ISO 19139 metadata with INSPIRE reference validator before publication", default = FALSE)
)
),
geoflow_action$new(
id = "geosapi-publish-ogc-services",
Expand All @@ -52,7 +63,15 @@ register_actions <- function(){
id = "zen4R-deposit-record",
type = "Data publication",
def = "Deposits/Publish data and/or metadata in the Zenodo infrastructure",
fun = zen4R_deposit_record
fun = zen4R_deposit_record,
options = list(
depositWithFiles = list(desc = "Indicates if the action is uploading files", default = FALSE),
publish = list(desc = "Indicates if the action should publish the deposit. Requires 'depositWithFiles' set to TRUE", default = FALSE),
deleteOldFiles = list(desc = "Indicates if the action should delete old files prior upload new files", default = TRUE),
update_metadata = list(desc = "For an existing deposit, indicates if metadata elements should be updated", default = TRUE),
update_files = list(desc = "For an existing deposit, indicates if files should be updated", default = TRUE),
communities = list(desc = "One or more communities to which the deposit should be associated", default = NA)
)
)
)
.geoflow$actions <- objs
Expand All @@ -76,3 +95,25 @@ list_actions <- function(raw = FALSE){
}
return(actions)
}

#'list_action_options
#'@export
list_action_options <- function(id){
out <- NULL
actions <- list_actions(raw = TRUE)
action <- actions[sapply(actions, function(x){x$id == id})]
if(length(action)==0) stop(sprintf("No action with id '%s'!", id))
action <- action[[1]]
if(length(action$options)>0){
out <- data.frame(
name = names(action$options),
definition = sapply(action$options, function(x){x$desc}),
default = sapply(action$options, function(x){x$default}),
stringsAsFactors = FALSE
)
row.names(out) <- 1:nrow(out)
}else{
out <- data.frame(name = character(0), definition = character(0))
}
return(out)
}
4 changes: 2 additions & 2 deletions R/geoflow_action_zen4R_deposit_record.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ zen4R_deposit_record <- function(entity, config, options){
deleteOldFiles <- if(!is.null(options$deleteOldFiles)) options$deleteOldFiles else TRUE
update_metadata <- if(!is.null(options$update_metadata)) options$update_metadata else TRUE
update_files <- if(!is.null(options$update_files)) options$update_files else TRUE
communities <- if(!is.null(options$community)) options$community else NULL
communities <- if(!is.null(options$community)) options$community else NA

#zenodo object
zenodo_metadata <- NULL
Expand Down Expand Up @@ -170,7 +170,7 @@ zen4R_deposit_record <- function(entity, config, options){
#TODO myrec$setAccessRight

#communities
if(!is.null(communities)){
if(!is.na(communities)){
zenodo_metadata$metadata$communities <- list()
for(community in communities) zenodo_metadata$addCommunity(community)
}
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://travis-ci.org/eblondel/geoflow.svg?branch=master)](https://travis-ci.org/eblondel/geoflow)
[![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.0.9003-blue.svg)](https://github.com/eblondel/geoflow)
[![Github_Status_Badge](https://img.shields.io/badge/Github-0.0.9004-blue.svg)](https://github.com/eblondel/geoflow)
[![DOI](https://zenodo.org/badge/DOI//10.5281/zenodo.3138920.svg)](https://doi.org//10.5281/zenodo.3138920)

[![Gitter](https://img.shields.io/badge/chat%20room-for%20users-brown.svg?style=flat-square)](https://gitter.im/geoflow-users/community)
Expand Down
4 changes: 2 additions & 2 deletions man/geoflow.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions man/list_action_options.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit aa0cf20

Please sign in to comment.