require(ospsuite.reportingengine)
#> Loading required package: ospsuite.reportingengine
#> Loading required package: ospsuite
#> Loading required package: rClr
#> Loading the dynamic library for Microsoft .NET runtime...
#> Loaded Common Language Runtime version 4.0.30319.42000
#> Loading required package: tlf
In Mean Model and Population workflows, title pages can be included using the reportTitle
input argument.
The example below will be used to illustrate the available options when adding a title page to the final report.
Code
# Get the pkml simulation file: "MiniModel2.pkml"
simulationFile <- system.file("extdata", "MiniModel2.pkml",
package = "ospsuite.reportingengine"
)
# Define the input parameters
outputA <- Output$new(
path = "Organism|A|Concentration in container",
displayName = "Concentration of A",
displayUnit = "nmol/ml"
)
setA <- SimulationSet$new(
simulationSetName = "A",
simulationFile = simulationFile,
outputs = outputA
)
Add a title only
When only a title is needed as a title page, the workflow will internally add the markdown title tag, "#"
, to the reportTitle
as illustrated below.
Code
# Create the workflow instance with the report title
workflow <-
MeanModelWorkflow$new(
simulationSets = setA,
workflowFolder = "Example-1",
reportTitle = "A meaningful title"
)
#> 10/03/2023 - 15:21:52
#>
[32m
[1mi Info
[22m
[39mReporting Engine Information:
#> Date: 10/03/2023 - 15:21:52
#> User Information:
#> Computer Name: WDEC030076
#> User: ZTSOJ
#> Login: ZTSOJ
#> System is NOT validated
#> System versions:
#> R version: R version 4.2.2 (2022-10-31 ucrt)
#> OSP Suite Package version: 11.1.198
#> OSP Reporting Engine version: 2.1.244
#> tlf version: 1.5.125
# Set the workflow tasks to be run
workflow$activateTasks(c("simulate", "plotTimeProfilesAndResiduals"))
# Run the workflow
workflow$runWorkflow()
#> 10/03/2023 - 15:21:53
#>
[32m
[1mi Info
[22m
[39mStarting run of
[36m
[1m
[3mMean Model Workflow
[23m
[22m
[39m
#> 10/03/2023 - 15:21:53
#>
[32m
[1mi Info
[22m
[39mStarting run of
[36m
[1m
[3mSimulation task
[23m
[22m
[39m
#> 10/03/2023 - 15:21:54
#>
[32m
[1mi Info
[22m
[39mSplitting simulations for parallel run:
[36m
[1m
[3m1
[23m
[22m
[39m simulations split into
[36m
[1m
[3m1
[23m
[22m
[39m subsets
#> 10/03/2023 - 15:21:54
#>
[32m
[1mi Info
[22m
[39mStarting run of
[36m
[1m
[3msubset simulations
[23m
[22m
[39m
#>
|
| | 0%
|
|======================================================================| 100%
#> 10/03/2023 - 15:21:55
#>
[32m
[1mi Info
[22m
[39m
[36m
[1m
[3mSimulation task
[23m
[22m
[39m completed in 0 min
#> 10/03/2023 - 15:21:55
#>
[32m
[1mi Info
[22m
[39mStarting run of
[36m
[1m
[3mPlot Time profiles and Residuals task
[23m
[22m
[39m
#> 10/03/2023 - 15:21:55
#>
[32m
[1mi Info
[22m
[39mStarting run of
[36m
[1m
[3mPlot Time profiles and Residuals task
[23m
[22m
[39m for
[36m
[1m
[3mA
[23m
[22m
[39m
#> 10/03/2023 - 15:22:00
#>
[32m
[1mi Info
[22m
[39m
[36m
[1m
[3mPlot Time profiles and Residuals task
[23m
[22m
[39m completed in 0.1 min
#> Executing: pandoc --self-contained --wrap=none --toc --from=markdown+tex_math_dollars+superscript+subscript+raw_attribute --reference-doc="C:/Users/ztsoj/AppData/Local/Temp/RtmpwxXS6L/temp_libpath298c4a21481f/ospsuite.reportingengine/extdata/reference.docx" --resource-path="Example-1" -t docx -o "Example-1/Report-word.docx" "Example-1/Report-word.md"
#> 10/03/2023 - 15:22:02
#>
[32m
[1mi Info
[22m
[39m
[36m
[1m
[3mMean Model Workflow
[23m
[22m
[39m completed in 0.2 min
Report
Add a title page
When the length of reportTitle
is longer than 1, the workflow will assume reportTitle
is a more advanced title page already formatted for markdown. In such cases, reportTitle
will used as is.
In the example below, the content of a more advanced title page is defined. The corresponding page includes
- A reference anchor that could be linked using
[Title page](#title-page)
- A title with a markdown title tag
- A table (using
kable
for markdown formatting)
Code
titlePage <- c(
anchor("title-page"),
"",
"# A meaningful title",
"",
knitr::kable(
data.frame(
Date = Sys.Date(),
Author = "OSP Suite - Reporting Engine",
Subject = "Example Workflow"
)
)
)
# Here, it is more optimal to re-use the previous workflow
# since only the report title page is changed and the same results are used
workflow$inactivateTasks("simulate")
workflow$reportTitle <- titlePage
# Re-run the workflow with the new title page
workflow$runWorkflow()
#> 10/03/2023 - 15:22:09
#> i Info Starting run of Mean Model Workflow
#> 10/03/2023 - 15:22:09
#> i Info Starting run of Plot Time profiles and Residuals task
#> 10/03/2023 - 15:22:09
#> i Info Starting run of Plot Time profiles and Residuals task for A
#> 10/03/2023 - 15:22:12
#> i Info Plot Time profiles and Residuals task completed in 0.1 min
#> Executing: pandoc --self-contained --wrap=none --toc --from=markdown+tex_math_dollars+superscript+subscript+raw_attribute --reference-doc="C:/Users/ztsoj/AppData/Local/Temp/RtmpwxXS6L/temp_libpath298c4a21481f/ospsuite.reportingengine/extdata/reference.docx" --resource-path="Example-1" -t docx -o "Example-1/Report-word.docx" "Example-1/Report-word.md"
#> 10/03/2023 - 15:22:14
#> i Info Mean Model Workflow completed in 0.1 min
Report
Use a file as title page
Another option is to use a markdown file as cover page. In this case, the file path can directly be defined in reportTitle
and the workflow will internally check that the file exists and include its content.
The example below save the previously defined title page as a file named :
Code
titlePageFile <- "title-page.md"
write(
x = titlePage,
file = titlePageFile
)
# Here, it is more optimal to re-use the previous workflow
# since only the report title page is changed and the same results are used
workflow$reportTitle <- titlePageFile
# Re-run the workflow with the new title page
workflow$runWorkflow()
#> 10/03/2023 - 15:22:21
#> i Info Starting run of Mean Model Workflow
#> 10/03/2023 - 15:22:21
#> i Info Starting run of Plot Time profiles and Residuals task
#> 10/03/2023 - 15:22:21
#> i Info Starting run of Plot Time profiles and Residuals task for A
#> 10/03/2023 - 15:22:25
#> i Info Plot Time profiles and Residuals task completed in 0.1 min
#> Executing: pandoc --self-contained --wrap=none --toc --from=markdown+tex_math_dollars+superscript+subscript+raw_attribute --reference-doc="C:/Users/ztsoj/AppData/Local/Temp/RtmpwxXS6L/temp_libpath298c4a21481f/ospsuite.reportingengine/extdata/reference.docx" --resource-path="Example-1" -t docx -o "Example-1/Report-word.docx" "Example-1/Report-word.md"
#> 10/03/2023 - 15:22:28
#> i Info Mean Model Workflow completed in 0.1 min
Report
Note
Note that running the workflow won’t delete the title page. The title file can be re-used if the workflow needs to be re-run.
file.exists(titlePageFile)
#> [1] TRUE