Releases: A2-ai/reportifyr
reportifyr 0.3.2
Improvements
- Added Windows support for
uv
installation, ensuring the setup script now works on both Unix-like (Unix/Mac) and Windows platforms.
Minor Improvements
- Added a
uv
version check such that the installed version is compared against requested version before installing requested version. - Removed comments from JSON outputs.
Bug Fixes
- Fixed changes to
.python_dependency_version.json
in.venv
not being propagated to the.python_dependency_version.json
inreport_dir_name
. - Fixed an issue where user supplied
python.version
viaoptions('python.version')
was creating a new line in both.python_dependency_version.json
files.
v0.3.1
Minor Improvements
-
If
config_yaml
is leftNULL
for the following functions, a defaultconfig.yaml
file bundled withreportifyr
is used instead:add_footnotes()
add_plots()
add_tables()
build_report()
finalize_document()
remove_tables_figures_footnotes()
-
validate_input_args()
andvalidate_alt_text_magic_strings()
no longer take aconfig_yaml
argument. -
Function and argument descriptions introduced or expanded on in 0.3.0 have been updated for clarity and understanding.
v0.3.0
New Features
-
config.yaml now included with the package and allows for greater control over reportifyr content.
-
config.yaml contents are summarized below:
-
Report configuration:
report_dir_name
captures the report directory name when callinginitialize_report_project()
.outputs_dir_name
captures the OUTPUTS directory name when callinginitialize_report_project()
.strict
iftrue
, errors if duplicate figures/tables are found in document. Iffalse
, duplicate figures will be inserted as duplicates, but only the first instance of a duplicate table is inserted.
-
Table configuration:
save_table_rtf
iftrue
, saves table artifacts as .RTF in addition to .csv/.RDS.
-
Figure configuration:
fig_alignment
[center/left/right] sets the alignment of the figure inserted into the document.use_embedded_dimensions
iftrue
, captures the size of the reportifyr figures within the document and maintains this size when updating artifact.use_artifact_size
iftrue
, uses the size of the saved artifact for dimensions when inserting the figure.default_fig_width
sets the default width (inches) to use for figures. Aspect ratio is maintained from saved artifact.label_multi_figures
iftrue
, for multi-figure insertion (see below) adds a figure label (A, B, C, etc.) to upper left corner of figures before inserting into the document.
-
Footnote configuration:
- font can be set through the
footnotes_font
field. - font size can be set through the
footnotes_font_size
field. use_object_path_as_source
iftrue
, sets the source footnote to use the path to the artifact instead of the script that generated it. Default setting isfalse
.wrap_path_in_[]
controls whether source/object footnotes are written as[path/to/source.R]
(true
) orpath/to/source.R
(false
). Default setting istrue
.combine_duplicate_footnotes
iftrue
, for multi-figure insertion (more below), only the first instance of duplicated footnotes will be inserted. To use,label_multi_figures
must be set tofalse
.footnote_order
sets the ordering of footnotes within the document.
- font can be set through the
-
-
validate_config(path_to_config_yaml)
function is included to ensure config is compatible with reportifyr.- All expected fields are checked for correct type and valid options for non-boolean fields. Any errors are surfaced to the user. Any additional fields not used in reportifyr are ignored.
- Examples:
fixing the capitalization on
> validate_config(here::here("inst/extdata/config.yaml")) 2025-04-11 09:54:53 [ERROR] footnotes_font_size should be integer/double, not: character 2025-04-11 09:54:53 [ERROR] Unexpected footnote field: source, object, notes, abbreviations. Acceptable fields are: Object, Source, Notes, Abbreviations 2025-04-11 09:54:53 [ERROR] Unexpected figure alignment option: middle. Acceptable alignments are: center, left, right [1] FALSE
footnote_order
, settingfig_alignment
to one of [center/left/right], and makingfootnotes_font_size
numeric gives the following result:> validate_config(here::here("inst/extdata/config.yaml")) [1] `true`
- Examples:
- All expected fields are checked for correct type and valid options for non-boolean fields. Any errors are surfaced to the user. Any additional fields not used in reportifyr are ignored.
-
-
initialize_report_project
has two new argumentsreport_dir_name
andoutputs_dir_name
.report_dir_name
sets the name/structure of where the report will be generated.outputs_dir_name
sets the name/structure of where the report artifacts will be saved.- Examples:
- You can provide nested directories to further organize a project that might have multiple reports. Here we create two reports one in
report/PK
and one inreport/NCA
and similarly separate the outputs into two subdirectories.This creates the following directory structure> initialize_report_project(here::here(), report_dir_name = "reports/PK", outputs_dir_name = "outputs/PK") If uv, Python, and Python dependencies (python-docx, PyYAML, Pillow) are not installed, this will install them. Otherwise, the installed versions will be used. Are you sure you want to continue? [Y/n] y Creating python virtual environment with the following settings: venv_dir: /Users/user/Documents/reportifyr_project python-docx.version: 1.1.2 pyyaml.version: 6.0.2 pillow.version: 11.1.0 uv.version: 0.7.8 python.version: 3.13.2 uv already installed Created venv at /Users/user/Documents/reportifyr_project/.venv Installed python-docx v1.1.2 Installed pyyaml v6.0.2 Installed pillow v11.1.0 copied standard_footnotes.yaml into /Users/user/Documents/reportifyr_project/reports/PK copied config.yaml into /Users/user/Documents/reportifyr_project/reports/PK > initialize_report_project(here::here(), report_dir_name = "reports/NCA", outputs_dir_name = "outputs/NCA") If uv, Python, and Python dependencies (python-docx, PyYAML, Pillow) are not installed, this will install them. Otherwise, the installed versions will be used. Are you sure you want to continue? [Y/n] y uv already installed venv already exists at /Users/user/Documents/reportifyr_project/.venv Current python-docx version: 1.1.2 python-docx already at correct version (v1.1.2) Current pyyaml version: 6.0.2 pyyaml already at correct version (v6.0.2) Current pillow version: 11.1.0 pillow already at correct version (v11.1.0) copied standard_footnotes.yaml into /Users/user/Documents/reportifyr_project/reports/NCA copied config.yaml into /Users/user/Documents/reportifyr_project/reports/NCA
. ├── outputs │ ├── NCA │ │ ├── figures │ │ ├── listings │ │ └── tables │ └── PK │ ├── figures │ ├── listings │ └── tables └── reports ├── NCA │ ├── config.yaml │ ├── draft │ ├── final │ ├── scripts │ ├── shell │ └── standard_footnotes.yaml └── PK ├── config.yaml ├── draft ├── final ├── scripts ├── shell └── standard_footnotes.yaml
- You can provide nested directories to further organize a project that might have multiple reports. Here we create two reports one in
initialize_report_project()
also creates a initialization .json file using the report_dir_name to store metadata about the report project setup.- Example
reports_NCA_init.json
created from the aboveinitialize_report_project
call:{ "creation_timestamp": "2025-04-11 10:14:29", "last_modified": "2025-04-11 10:14:29", "user": "user", "config": { "report_dir_name": "reports/NCA", "outputs_dir_name": "outputs/NCA", "footnotes_font": "Arial Narrow", "footnotes_font_size": "10", "use_object_path_as_source": false, "wrap_path_in_[]": true, "combine_duplicate_footnotes": true, "footnote_order": ["source", "object", "notes", "abbreviations"], "save_table_rtf": false, "fig_alignment": "middle", "use_artifact_size": true, "default_fig_width": 6, "use_embedded_dimensions": true, "label_multi_figures": false }, "python_versions": { "venv_dir": "/Users/user/Documents/reportifyr_project", "python-docx.version": "1.1.2", "pyyaml.version": "6.0.2", "pillow.version": "11.1.0", "uv.version": "0.7.8", "python.version": "3.13.2" } }
- Example
-
sync_report_project(project_dir, report_dir_name)
has been added to synchronize the report project with both the config.yaml and any Python dependency versions set withoptions()
to ensure that reportifyr is using the desired specifications.sync_report_project()
consults the initialization file, options, and config.yaml to bring them to a consistent state, updating the init file if needed.- Example:
> options("python-docx.version" = "1.1.1") > sync_report_project(here::here(), "reports/NCA") Python dependency versions have been changed, updating /Users/user/Documents/reportifyr_project/.reports_NCA_init.json uv already installed venv already exists at /Users/user/Documents/reportifyr_project/.venv Current python-docx version: 1.1.2 Updating python-docx from v1.1.2 to v1.1.1 Installed python-docx v1.1.1 Current pyyaml version: 6.0.2 pyyaml already at correct version (v6.0.2) Current pillow version: 11.1.0 pillow already at correct version (v11.1.0)
- Example:
-
validate_document(docx_in, config_yaml)
has been added to check that the document is in a format compatible with reportifyr use. Magic strings withindocx_in
are checked for duplicate artifacts and warns/errors (depending onstrict
config) user about duplicates.
Magic String Updates:
-
Multiple figures (multi-figure) with a single combined footnote can now be added with the following syntax:
Figure 1: Multiple figures with single footnote.
{rpfy}:[figure_1.png, figure_2.png].The resulting document after
build_report()
will look like the following:Figure 1: Multiple figures with single footnote.
{rpfy}:[figure_1.png, figure_2.png].
A[Figure 1]
B[Figure 2]
Source: A: path/to/figure_1_source.R Timestamp. B: path/to/figure_2_source.R Timestamp.
...
v0.2.6
v0.2.5
v0.2.4
Full Changelog: v0.2.2...v0.2.4
v0.2.4
What's Changed
Bugs Fixed
- Figures were not removed if there was a new paragraph after {rpfy}: string.
- table1_format was not being passed to write_object_metadata so table1 formatting was not being applied.
v0.2.3
v0.2.3 - bug fixes
What's Changed
Full Changelog: v0.2.2...v0.2.3
Bugs Fixed
- with uv version being pinned, output messaging in
initialize_python
printed uv version for python version. Updated to include uv version in print out and correctly print python version as well.
New Features
- added
doc_in
to output ofmake_doc_dirs(docx_in)
for convenience
uv pined and path fix
Small update to fix breaking change with uv's installation path change. We have now pinned uv's version to 0.5.1. Users can choose which version of uv to install by setting the options("uv.version" = "major.minor.patch")
.
What's Changed
Full Changelog: v0.2.1...v0.2.2
v0.2.1
v0.2.1 - Elective footnotes
What's Changed
Full Changelog: v0.2.0...v0.2.1
Bugs Fixed
- Untracked File Source Path: Fixed an issue where the source path of untracked source file in a git repository was not captured, leading to a blank source footnote without error messages.
- Default Path for Console Sourced Scripts: Corrected the logic that previously defaulted to setting the source path to the current working directory when scripts were sourced from the console rather than the file sourced.
- Source Tracking Warnings: Added a warning to the log if the source script is not tracked by git. The source footnote now displays "FILE NOT TRACKED BY GIT."
- Accurate Source Path Detection: Enhanced the logic to correctly identify the source file being executed, regardless of the file open in the editor.
New Features
- Elective Footnotes: Introduced more customizable options for handling footnotes, detailed in a new vignette: Elective footnotes.
- Disable Footnotes: You can now disable footnotes entirely by setting
add_footnotes = FALSE
inbuild_report
. - Footnote Management for Missing Metadata: Added the ability to add figures or tables without footnotes. If a table or figure lacks an associated metadata file, set
footnotes_fail_on_missing_metadata = FALSE
inbuild_report
oradd_footnotes
to bypass errors and log warnings instead. These figures/tables will not get footnotes added. - Object Path Footnote: Added the ability to include an object path footnote to help trace the origin of tables or figures within a script. This feature can be enabled by setting
include_object_path = TRUE
inbuild_report
oradd_footnotes
.
v0.2.0 - Bug Fix
Bug Fixes
- Fixed a bug that caused filenames to be incorrect when whitespace was present after the magic string. Whitespace is now trimmed before determining filename.