phuse-org / valtools

Validation framework for R packages used in clinical research and drug development.
https://phuse-org.github.io/valtools/
Other
51 stars 10 forks source link

Validation Report generation approach #44

Closed thebioengineer closed 3 years ago

thebioengineer commented 3 years ago

I wanted to document how we wanted to approach building up the validation report since it is comprised of multiple pieces that depend on the users goals whether they are

We could take the "don't edit this" approach of roxygen2 x namespace relationship, Where the users document the order in which they expect things to appear in the report like the bookdown yaml approach.

Or the copy into clipboard and its up to the user to insert a la badges in readme from usethis.

or automatically add it to the end of the file,

or fill in the document with everything we can think of and the user needs to drop/remove unexpected content.

I can see value in all these approaches, so I wanted to air it out

mariev commented 3 years ago

hmmm - that's a good point, What would be available only in the source package form? Is it only the function author details that can't be copied as part of /validation/?

Thinking about /validation/ as the set of files that get preserved regardless of method means the report will always have access to the requirements/test cases/test code. So the report RMD can always scrape those roxygen blocks during render. The test code will be evaluated when the report is rendered, so that code won't vary between scenarios - same for any code retrieving validation environment details. Signature block info is captured via .validation config, so that file should be considered part of the set of files that are ported around.

thebioengineer commented 3 years ago

I have been thinking about that as well. part of the build process when the validation is happening from within the R package will need to copy the .validation into inst/ and will also scrape the roxygen blocks and store them inside inst/validation/R or something

elimillera commented 3 years ago

I really like the YAML approach. We could almost consider this like building a pkgdown page. In that, you can specify different styling options and exactly specify what you want to appear, in what order, and how it should be grouped

thebioengineer commented 3 years ago

to move some comments from #65:

What will rendering look like?

How to do this?

---
title: Validation Report
author: Validation Lead
date: "`r Sys.Date()`"
output: pdf_document
---

```{r include = FALSE}
vt_generate_validation_report()


  - `vt_generate_validation_report()` (STILL OPEN TO NEW NAME) would be the workhorse to read the file order from validation.yml, and start printing the contents "asis". The child documents (other than req, test_cases) are to live, and we concluded that our approach could be that the contents could live anywhere within the `{{working directory}}/validation` directory and the function would search out the file.

Questions I have:
 - How to approach the test code, since it is written as an R script, we would need another file to provide the rendering/formatting, correct?
 - will we have a new suite of "vt_use_*" for the report infra: `vt_use_sig_table`, `vt_use_env_report()`, etc?
mariev commented 3 years ago

My understanding is that, regardless of validation paradigm, a validation report ultimately is a single .RMD document. {valtools} users can create this by:

  1. Writing the .Rmd validation report directly, calling helper functions like vt_run_test_code_file in specific R chunks and adding whatever custom combo of R chunks/markdown/LaTeX/HTML code they are comfortable using. This is especially useful for developers who may need customize report formatting for their org's needs e.g. if SOP dictates that signatures are captured using a separate form.

  2. Using a {valtools} function to create the .Rmd validation report using validation.yml details i.e building up from the files listed in validation_files list.

A couple notes on this process:

thebioengineer commented 3 years ago

oohh...so vt_generate_report would populate based on the validation.yml an rmd that would then serve as the report?

mariev commented 3 years ago

I think if our goal is to facilitate "validate on install" as the default paradigm, we need to focus on how {valtools} functions make writing that vignette content pain-free.