Skip to content

Releases: A2-ai/reportifyr

reportifyr 0.3.2

14 Aug 18:25
10e053e
Compare
Choose a tag to compare

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 in report_dir_name.
  • Fixed an issue where user supplied python.version via options('python.version') was creating a new line in both .python_dependency_version.json files.

v0.3.1

10 Jun 18:10
d959bd4
Compare
Choose a tag to compare

Minor Improvements

  • If config_yaml is left NULL for the following functions, a default config.yaml file bundled with reportifyr is used instead:

    • add_footnotes()
    • add_plots()
    • add_tables()
    • build_report()
    • finalize_document()
    • remove_tables_figures_footnotes()
  • validate_input_args() and validate_alt_text_magic_strings() no longer take a config_yaml argument.

  • Function and argument descriptions introduced or expanded on in 0.3.0 have been updated for clarity and understanding.

v0.3.0

30 May 19:02
8788358
Compare
Choose a tag to compare

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 calling initialize_report_project().
        • outputs_dir_name captures the OUTPUTS directory name when calling initialize_report_project().
        • strict if true, errors if duplicate figures/tables are found in document. If false, duplicate figures will be inserted as duplicates, but only the first instance of a duplicate table is inserted.
      • Table configuration:

        • save_table_rtf if true, 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 if true, captures the size of the reportifyr figures within the document and maintains this size when updating artifact.
        • use_artifact_size if true, 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 if true, 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 if true, sets the source footnote to use the path to the artifact instead of the script that generated it. Default setting is false.
        • wrap_path_in_[] controls whether source/object footnotes are written as [path/to/source.R] (true) or path/to/source.R (false). Default setting is true.
        • combine_duplicate_footnotes if true, for multi-figure insertion (more below), only the first instance of duplicated footnotes will be inserted. To use, label_multi_figures must be set to false.
        • footnote_order sets the ordering of footnotes within the document.
    • 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:
          > 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
          
          fixing the capitalization on footnote_order, setting fig_alignment to one of [center/left/right], and making footnotes_font_size numeric gives the following result:
          > validate_config(here::here("inst/extdata/config.yaml"))
          [1] `true`
          
  • initialize_report_project has two new arguments report_dir_name and outputs_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 in report/NCA and similarly separate the outputs into two subdirectories.
        > 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
        
        This creates the following directory structure
        .
        ├── 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
        
    • 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 above initialize_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"
          }
        }
        
  • 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 with options() 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)
      
  • validate_document(docx_in, config_yaml) has been added to check that the document is in a format compatible with reportifyr use. Magic strings within docx_in are checked for duplicate artifacts and warns/errors (depending on strict 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.
    ...

Read more

v0.2.6

24 Feb 16:22
572ed3c
Compare
Choose a tag to compare

Full Changelog: v0.2.5...v0.2.6

v0.2.6

Bugs Fixed

  • Bug fixes around removing bookmarks by @jacobdum in #8

New Features

  • CLI prompt upon using initialize_report_project or initialize_python()

v0.2.5

19 Nov 16:06
Compare
Choose a tag to compare

Full Changelog: v0.2.4...v0.2.5

v0.2.5

Bugs Fixed

  • bug fixes around table Notes footnote insertion by @mduncans in #6

v0.2.4

13 Nov 15:55
a235689
Compare
Choose a tag to compare

Full Changelog: v0.2.2...v0.2.4

v0.2.4

What's Changed

  • bug fixes around figure removal and table formatting by @mduncans in #6

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

12 Nov 15:17
90fc161
Compare
Choose a tag to compare

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 of make_doc_dirs(docx_in) for convenience

uv pined and path fix

11 Nov 20:54
1c08110
Compare
Choose a tag to compare

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

  • updated uv path determinatino with uv v0.5.0 installing to ~/.local/b… by @mduncans in #4

Full Changelog: v0.2.1...v0.2.2

v0.2.1

01 Nov 01:14
d47be9e
Compare
Choose a tag to compare

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 in build_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 in build_report or add_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 in build_report or add_footnotes.

v0.2.0 - Bug Fix

28 Oct 15:21
f4474df
Compare
Choose a tag to compare

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.