Skip to content

Enhancement: Allow export/download of all generated TLGs - #1428

Open
h5hoang wants to merge 14 commits into
mainfrom
1344-enhancement-export-download-tlgs
Open

Enhancement: Allow export/download of all generated TLGs#1428
h5hoang wants to merge 14 commits into
mainfrom
1344-enhancement-export-download-tlgs

Conversation

@h5hoang

@h5hoang h5hoang commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Issue

Closes #1344

Description

Rendered TLGs can now be exported. They appear as a branch in the existing Export as ZIP dialog, alongside the other results, once a TLG order has been submitted:

TLGs/
  Graphs/pdf/pkcg01_lin.pdf          one multi-page document per output
  Graphs/png/pkcg01_lin/S1.png       one image per plot, if PNG is chosen
  Tables/xlsx/pkct01.xlsx            one workbook, a sheet per split
  Tables/csv/pkct01/PARAM_DrugA.csv
  Listings/xlsx/pkcl01.xlsx
  manifest.csv                       new file I introduced as a tracker

Getting the outputs out of the modules:

  • tlg_module_server returns its tlg_list reactive instead of nothing, and tab_tlg_server keeps those in a per-session registry, so the export writes what is actually on screen — sidebar option edits included — rather than re-running the catalog with defaults
  • the registry is intersected with the current order, so a TLG removed and re-submitted does not linger in the archive
  • the panel outputs and each module's options widget opt out of suspendWhenHidden; without that, a tab the user never opened contributed nothing to the export

Formats (inst/shiny/functions/zip-utils.R):

  • rendered TLGs get their own control in the dialog rather than sharing the CDISC dataset formats,
  • defaults are PDF for graphs and XLSX for tables and listings.
  • graphs: PDF as one multi-page document per output, or PNG/HTML one file per plot. Rendered from the ggplot behind each widget
  • tables and listings: XLSX collapses a split output into one workbook with a sheet per split; CSV keeps one file per split. Listings are reduced to their displayed columns, and grouped ("Compare in columns") tables get their two-level header flattened to F - Geometric Mean
  • a TLG that errors or is still gated is recorded in manifest.csv and skipped,

Everything else:

  • inst/shiny/functions/tlg_export.R handles file naming, the folder layout and the manifest
  • save_dispatch() gained PDF, XLSX and plotly→PNG rather than growing a second writer alongside it
  • .make_zip_filename() takes a suffix so both exports share the project/study naming
  • a TLG that errors or is still gated is recorded in manifest.csv and skipped, so one broken output does not cost the user the other thirty

Definition of Done

  • Download button available in the TLG section after TLGs are rendered
  • Graphs exported as PNG
  • Tables exported as CSV/XLSX
  • Listings exported as CSV/XLSX
  • All exported files bundled in a ZIP with Graphs/, Tables/, Listings/
  • File names follow a consistent convention (pkcg01_lin_DrugA.png)

How to test

  1. Upload data, map, run NCA, go to TLG -> Submit Order Details
  2. Open Export as ZIP (sidebar header) → tick TLGs in the tree → choose formats → Export
  3. Unzip: check the three folders and manifest.csv, that PNGs are not blank, and that the XLSX files open
  4. Change a sidebar option (a title, or stratification) and re-download (the export should reflect it)
  5. Remove a TLG from the order, re-submit, re-download (it should be gone from the zip)
  6. Enable a TLG that errors on your data (the download should still complete, with the reason recorded in the manifest)

Contributor checklist

  • Code passes lintr checks
  • Code passes all unit tests
  • New logic covered by unit tests
  • New logic is documented
  • App or package changes are reflected in NEWS
  • Package version is incremented
  • R script works with the new implementation (if applicable)
  • Settings upload works with the new implementation (if applicable)
  • If any .scss change was done, run data-raw/compile_css.R
  • If a package dependency was added/changed, run data-raw/test_suggests_hidden.R

Notes to reviewer

  • there was an issue with graphs not downloading when you click export, and that you needed to open the graphs tab and click on every graph tab for it to be exported, but it should be fixed. but could you guys double check and make sure that graphs are part of the export?
  • manifest.csv is an artifact I introduced as part of this PR, but it lists out every rendered output with its file path and a status (ok, skipped, empty, error) just so that if a TLG failed to be produced/exported, it would tell me rather than I have to dig through the folders and make sure all are present
  • some graphs have overlapping x-axis labels if PK profile is dense, created an issue since that is out of scope for this PR (Bug: axis break filtering ignores label width, so long tick labels overlap #1441)
@h5hoang h5hoang linked an issue Aug 11, 2026 that may be closed by this pull request
6 tasks
@h5hoang
h5hoang changed the base branch from main to 1335-enhancement-simplify-tlg-order-details-table-and-internalize-pcspec-filtering August 11, 2026 20:54
Base automatically changed from 1335-enhancement-simplify-tlg-order-details-table-and-internalize-pcspec-filtering to main August 24, 2026 20:07
@h5hoang
h5hoang marked this pull request as ready for review August 24, 2026 21:17
@h5hoang h5hoang mentioned this pull request Aug 31, 2026
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant