runAutoReport: Run reports as defined in yaml config and ship content by...

View source: R/autoReport.R

runAutoReportR Documentation

Run reports as defined in yaml config and ship content by email

Description

Usually to be called by a scheduler, e.g. cron. If the provided day of year matches those of the config the report is run as otherwise specified in config. Functions called upon are expected to return a character string providing a path to a file that can be attached to an email or, in case of a bulletin, the email body itself. For bulletins, files cannot be attached. The email itself is prepared and sent to recipients defined in the config

Usage

runAutoReport(
  dayNumber = as.POSIXlt(Sys.Date())$yday + 1,
  type = c("subscription", "dispatchment"),
  dryRun = FALSE
)

Arguments

dayNumber

Integer day of year where January 1st is 1. Defaults to current day, i.e. as.POSIXlt(Sys.Date())$yday + 1 (POSIXlt yday is base 0)

type

Character vector defining the type of reports to be processed. May contain one or more of c("subscription", "dispatchment", "bulletin"). Defaults value set to c("subscription", "dispatchment").

dryRun

Logical defining if emails are to be sent. If TRUE a message with reference to the payload file is given but no emails will actually be sent. Default is FALSE

Value

Emails with corresponding file attachment. If dryRun == TRUE just a message

Examples


# Example depend on environment variable R_RAP_CONFIG_PATH being set
runAutoReport()



Rapporteket/rapbase documentation built on Nov. 22, 2023, 9:21 p.m.