Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Initialize report using functions #12

Open
wants to merge 30 commits into
base: main
Choose a base branch
from

Conversation

Felixmil
Copy link
Collaborator

@Felixmil Felixmil commented Aug 30, 2023

The new_report() function will create a directory using the "report_name" argument with 3 files and 1 directory:

  • [report_name].qmd, the report template
  • _quarto.yml, all the quarto metadata/settings
  • a .gitignore file
  • a figures directory

For example, in a new project created by the powershell script, use new_report() to initialize a new report.

esqlabsR.reports::new_report("my_report", "../Report/")

image

image

image

The .qmd yaml header only contains the fields that the user is most likely to change + the params:

---
title: my_report
subtitle: ''
author: esqLABS GmbH
date: now
params:
  loadPreSimulatedResults: no
  loadResultsFolder: ~
  saveResultsFolder: ~
  setTestParameters: no
  createOnlyStaticContent: yes
---

The other settings are stored in the _quarto.yml file that will be read by quarto during rendering:

project:
  title: "esqlabsR.report.template"

date-format: "YYYY-MM-DD HH:mm:ss"

# Execution options
execute:
  echo: false # do not show code chunks
  output: true
  warning: false # do not print warning
  cache: false # do not use cache unless specified in chunks

# Output format options
format:
  pdf:
    # table of contents and lists
    # Caption locations
    # Other
    # Figures rendering
    # Document layout as used by Word reports
    toc: true # display table of content (TOC)
    toc-depth: 3 # display three levels in TOC
    toc-title: Table of Content # override default "Content" TOC title
    lof: false # Print list of figures?
    lot: false # Print list of tables?
    fig-cap-location: bottom # figure captions location
    tbl-cap-location: bottom # table captions location
    number-sections: true # add number to s
    ...

The basic metadata can be directly customize by the user and will be injected in the yaml header:
image

usethis::use_git()
usethis::use_github()
usethis::use_tidy_github_actions()
usethis::use_tidy_github_labels()
usethis::use_pkgdown_github_pages()
…tadata.

+ The new_report function has argument so that the report yaml can easily be customized.
+ only most important metadata and params are kept in the template.
Merge commit 'b016f6238f80771e7d60404fe63e597b48724953'

#Conflicts:
#	DESCRIPTION
#	R/new_report.R
#	tests/testthat/test-new_report.R
@Felixmil Felixmil marked this pull request as draft August 30, 2023 12:08
@Felixmil
Copy link
Collaborator Author

@PavelBal There are still other tasks in progress in this branch but could you please share your thoughs on this ?

@PavelBal
Copy link
Member

First remark - stick to the camelCase naming convention ;)

Otherwise, I like the idea very much! One thing - if the reports are not located in the "Code" folder, cloning the whole "V00.01" folder to "V00.02" (as an example) and then starting the project with V00.02 code will have the OLD report opened in RStudio which is absolutely confusing.

@Felixmil
Copy link
Collaborator Author

Felixmil commented Sep 4, 2023

@PavelBal Shall we make simulateScenarios and other "utils" function part of {esqlabsR} ?

This would allow us to insert these functions in the template without having to source other files. This way, the user just needs to provide the rights arguments.

Then the simulations are run or not depending on the notebooks's parameters

@PavelBal
Copy link
Member

PavelBal commented Sep 4, 2023

I would not do it now, maybe in future when we have gathered some experience. Otherwise I am afraid we will have too many "run/simulate/xxx Scenarios` functions in the core package.

@Felixmil
Copy link
Collaborator Author

This is the resulting output of the template

template.pdf

@Felixmil Felixmil linked an issue Sep 19, 2023 that may be closed by this pull request
@Felixmil Felixmil marked this pull request as ready for review September 20, 2023 12:14
+ rework default template
+ add data and figures for default template
+ Update scripts for default template
@Felixmil
Copy link
Collaborator Author

Theme was updated, the "test" reports now look like this:

Dextromethorphan qualification report.pdf

The default template contains everything to produce this document:
template.pdf

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Review first template version
2 participants