Skip to contents

`r lifecycle::badge("stable")`

This function generates a KRI report based on the provided inputs.

Usage

Report_KRI(
  lCharts = NULL,
  dfResults = NULL,
  dfGroups = NULL,
  dfMetrics = NULL,
  strOutputDir = getwd(),
  strOutputFile = NULL
)

Arguments

lCharts

A list of charts to include in the report.

dfResults

`data.frame` A stacked summary of analysis pipeline output. Created by passing a list of results returned by [Summarize()] to [BindResults()]. Expected columns: `GroupID`, `GroupLevel`, `Numerator`, `Denominator`, `Metric`, `Score`, `Flag`, `MetricID`, `StudyID`, `SnapshotDate`.

dfGroups

`data.frame` Group-level metadata dictionary. Created by passing CTMS site and study data to [MakeLongMeta()]. Expected columns: `GroupID`, `GroupLevel`, `Param`, `Value`.

dfMetrics

`data.frame` Metric-specific metadata for use in charts and reporting. Created by passing an `lWorkflow` object to [MakeMetric()]. Expected columns: `File`, `MetricID`, `Group`, `Abbreviation`, `Metric`, `Numerator`, `Denominator`, `Model`, `Score`, and `Threshold`. For more details see the Data Model vignette: `vignette("DataModel", package = "gsm.core")`.

strOutputDir

The output directory path for the generated report. If not provided, the report will be saved in the current working directory.

strOutputFile

The output file name for the generated report. If not provided, the report will be named based on the study ID, Group Level and Date.

Value

File path of the saved report html is returned invisibly. Save to object to view absolute output path.

Examples

if (FALSE) { # \dontrun{
# Run site-level KRI report.
lChartsSite <- MakeCharts(
  dfResults = gsm.core::reportingResults,
  dfGroups = gsm.core::reportingGroups,
  dfMetrics = gsm.core::reportingMetrics,
  dfBounds = gsm.core::reportingBounds
)

strOutputFile <- "StandardSiteReport.html"
kri_report_path <- Report_KRI(
  lCharts = lChartsSite,
  dfResults = gsm.core::reportingResults,
  dfGroups = gsm.core::reportingGroups,
  dfMetrics = gsm.core::reportingMetrics,
  strOutputFile = strOutputFile
)

# Run country-level KRI report.
lChartsCountry <- MakeCharts(
  dfResults = gsm.core::reportingResults_country,
  dfGroups = gsm.core::reportingGroups_country,
  dfMetrics = gsm.core::reportingMetrics_country,
  dfBounds = gsm.core::reportingBounds_country
)

strOutputFile <- "StandardCountryReport.html"
kri_report_path <- Report_KRI(
  lCharts = lChartsCountry,
  dfResults = gsm.core::reportingResults_country,
  dfGroups = gsm.core::reportingGroups_country,
  dfMetrics = gsm.core::reportingMetrics_country,
  strOutputFile = strOutputFile
)
} # }