Learn R Programming

geoflow (version 1.2.0)

geoflow_action: Geoflow action class

Description

This class models an action to be executed by geoflow

Arguments

Value

Object of R6Class for modelling an action

Format

R6Class object.

Author

Emmanuel Blondel <emmanuel.blondel1@gmail.com>

Super class

geoflow::geoflowLogger -> geoflow_action

Public fields

id

action ID

enabled

enabled

funders

funders

authors

authors

maintainer

maintainer

scope

action scope

types

types of action

def

the action definition

target

the action target

target_dir

the action target directory

packages

list of packages required to perform the action

pid_generator

a name referencing the PID generator (if existing)

pid_types

types of PIDs to generate

generic_uploader

whether the action is a generic uploader or not.

fun

a function for the action

script

a script for the action

options

action options

available_options

a list of available options for the actions

status

status

notes

notes

Methods

Inherited methods


Method new()

Initialize a geoflow_action

Usage

geoflow_action$new(
  yaml = NULL,
  id = NULL,
  enabled = TRUE,
  funders = list(),
  authors = list(),
  maintainer = NULL,
  scope = "global",
  types = list(),
  def = "",
  target = NA,
  target_dir = NA,
  packages = list(),
  pid_generator = NULL,
  pid_types = list(),
  generic_uploader = FALSE,
  fun = NULL,
  script = NULL,
  options = list(),
  available_options = list(),
  status = "stable",
  notes = ""
)

Arguments

yaml

a yaml file

id

action id

enabled

enabled

funders

funders

authors

authors

maintainer

maintainer

scope

action scope "global" or "local"

types

action types

def

action definition

target

the action target, e.g. "entity"

target_dir

the action target directory

packages

list of packages required to perform the action

pid_generator

a name referencing the PID generator (if existing)

pid_types

types of PIDs to generate by the action

generic_uploader

whether the action is a generic uploader or not.

fun

action function

script

action script

options

action options

available_options

available options for the action

status

status of the action (experimental, stable, deprecated, superseded)

notes

notes


Method fromYAML()

Reads action properties from YAML file

Usage

geoflow_action$fromYAML(file)

Arguments

file

file


Method checkPackages()

Check that all packages required for the action are available, if yes, import them in the R session, and return a data.frame giving the packages names and version. If one or more packages are unavailable, an error is thrown and user informed of the missing packages.

Usage

geoflow_action$checkPackages()


Method run()

Runs the action

Usage

geoflow_action$run(entity, config)

Arguments

entity

entity

config

config


Method getOption()

Get action option value

Usage

geoflow_action$getOption(option)

Arguments

option

option id

Returns

the option value, either specified through a workflow, or the default value


Method isPIDGenerator()

Indicates if the action is PID generator

Usage

geoflow_action$isPIDGenerator()

Returns

TRUE if the action is a PID generator, FALSE otherwise


Method exportPIDs()

Exports PIDs for the action. This function will export the PIDs in several ways. First, a simple CSV file including the list of PIDs for each entity, and associated status (eg. draft/release) for the given PID resource. In addition, for each metadata entities file, an equivalent metadata table will be produced as CSV to handle entities enriched with the PID (added in the "Identifier" column), ready for use as workflow entities input. In addition, a new configuration file will be produced with name "<pid_generator>_geoflow_config_for_publication.json" turned as ready for publishing resources with PIDs (eg. publishing deposits in Zenodo).

Usage

geoflow_action$exportPIDs(config, entities)

Arguments

config

a geoflow configuration

entities

one or more objects of class geoflow_entity


Method isGenericUploader()

Indicates if the action is a generic uploader

Usage

geoflow_action$isGenericUploader()

Returns

TRUE if the action is a generic uploader, FALSE otherwise


Method clone()

The objects of this class are cloneable with this method.

Usage

geoflow_action$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Details

geoflow_action

Examples

Run this code
if (FALSE) {
  action <- geoflow_action$new(
   id = "some-id",
   scope = "global",
   types = list("some purpose1", "some purpose2"),
   target = "entity",
   target_dir = "data",
   def = "some definition",
   packages = list(),
   pid_generator = NULL,
   generic_uploader = FALSE,
   fun = function(action, entity, config){},
   available_options = list(
     option_name = list(def = "option description", default = FALSE)
   ),
   options = list(option_name = TRUE)
 )
}

Run the code above in your browser using DataLab