list_mapping_buR Documentation

Fill an empty BU template with data from an unformatted XLSX

Description

Use a mapping file to recast the values of a source file into a format adapted to the bulk upload process (BU). This function can use, for example, geom_within_gs() to test if the coordinates are within a grid cell.

Usage

list_mapping_bu(
  bu.path = paste0(system.file(package = "eamenaR"), "/extdata/bu/"),
 
    bu.template.path = "C:/Rprojects/eamena-arches-dev/data/bulk/templates/Heritage Place BUS Template.xlsx",
  mapping.file = paste0(system.file(package = "eamenaR"), "/extdata/mapping_bu.xlsx"),
  mapping.file.ggsheet = FALSE,
  job = "mk",
  job.type = "mk_type",
  eamena.field = "target",
  eamena.id = "UNIQUEID",
  verbose = TRUE
)

Arguments

bu.path

the path to the BU folder. The BU folder (‘bu/') is the root of job folders (ex: ’mk/', see the 'job' option description). Each job contains one to several BU worksheets. The output subfolder 'out/' will be created by the function to store the output files. BU files could be either XLSX or CSV.

bu.template.path

the path to the BU template. The output will be written into this structure

mapping.file

the path to the XLSX or Google Sheet file providing the equivalences (mapping) between the source file (unformatted) and the target file (formatted as a BU).

mapping.file.ggsheet

is the mapping file a Google Sheet (for example: 'https://docs.google.com/spreadsheets/d/1nXgz98mGOySgc0Q2zIeT1RvHGNl4WRq1Fp9m5qB8g8k/edit#gid=1083097625'), by default: FALSE.

job

the job folder is a subfolder of ‘bu/'. It contains the unformatted XLSX datasets. 'job' is also the name of the source fields in the mapping file. By default ’mk'.

job.type

the name of the field in the 'mapping.file' XLSX giving the name of the mapping function to do: - 'field': one-to-one correspondences, the source values will be copied as it into the target file; - 'value': constant values (ie, always the same value) that will be copied into the target file; - 'expression': logical functions (mainly if statements). These functions are written directly in the appropriate cell of the mapping file; - 'escape': values depending from another column evaluated by 'expression'. This field is not read - 'other': when a column (ex: 'Seen') as a value (ex: 'Yes') that refers to several values scattered on different target columns. - 'supplem': to add supplementary rows like pipes '|' for already existing rows (ex: the alternative name of a place, two different actors)

eamena.field

the name of the field in the ‘mapping.file' XLSX with the name of the EAMENA fields in a R format (’UNIQUEID', 'Assessment.Investigator.-.Actor', 'Investigator.Role.Type', etc.)

eamena.id

the unique key identifier for a single resource, by default 'UNIQUEID'

verbose

if TRUE (by default): verbose

Value

One or various XLSX files (almost) ready for an bulk upload process in the EAMENA DB. These files are names in the same way as the input file, except a '_out' suffix is added.

Examples


list_mapping_bu()

list_mapping_bu(mapping.file = 'https://docs.google.com/spreadsheets/d/1nXgz98mGOySgc0Q2zIeT1RvHGNl4WRq1Fp9m5qB8g8k/edit#gid=1083097625',
                mapping.file.ggsheet = T)