Skip to content

feat: add PPTESTCD glossary slide to PowerPoint export#1326

Open
Shaakon35 wants to merge 12 commits into
mainfrom
1325-enhancement/pptestcd-glossary-slide
Open

feat: add PPTESTCD glossary slide to PowerPoint export#1326
Shaakon35 wants to merge 12 commits into
mainfrom
1325-enhancement/pptestcd-glossary-slide

Conversation

@Shaakon35

Copy link
Copy Markdown
Collaborator

Issue

Closes #1325

Description

Adds a glossary slide as the second slide in the PowerPoint export (after the title slide, before content). The glossary is a two-column table (PPTESTCD | PPTEST) listing all PK parameter codes used in the presentation, looked up from metadata_nca_parameters.

Changes

  • .collect_pptestcds() — collects all unique PPTESTCDs from statistics tables (column names), individual parameter tables (column names), and boxplot names across all dose groups.
  • .build_glossary() — filters metadata_nca_parameters to matching codes and returns a sorted, deduplicated two-column data frame.
  • .add_pptx_glossary_slides() — renders the glossary as a flextable on "Title Only" layout slides, splitting across multiple slides when exceeding 20 rows.
  • create_pptx_dose_slides() — integrates the glossary after the title slide and adjusts slide index offsets so summary slide reordering remains correct.

Definition of Done

  • Glossary slide inserted as the second slide in the PowerPoint export
  • Table contains two columns: PPTESTCD and PPTEST
  • Only PPTESTCDs actually used in the presentation are included
  • Labels sourced from metadata_nca_parameters
  • Long glossaries split across multiple slides if needed
  • Existing slide ordering preserved after the glossary

How to test

  1. Run NCA on a dataset, then export PowerPoint via Save > PPTX
  2. Open the generated .pptx — slide 2 should be a "Glossary" table
  3. Verify the table lists only the PPTESTCDs that appear in the rest of the deck
  4. Test with a dataset that produces many parameters (>20) to verify multi-slide splitting

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

  • The glossary only includes PPTESTCDs that match entries in metadata_nca_parameters. Non-standard codes (e.g., column names like "Statistic", "USUBJID") that appear in table headers are silently excluded since they have no match in the metadata.
  • The max_rows parameter (default 20) controls pagination. Adjustable if the template layout fits more or fewer rows.
  • Slide index arithmetic in create_pptx_dose_slides was updated: lst_group_slide starts at 1 + n_glossary_slides and summary slides move to first_content_pos (= 2 + n_glossary_slides) instead of hardcoded 2."

Shaakon35 and others added 3 commits May 27, 2026 08:51
Insert a glossary slide after the title slide listing all PPTESTCD/PPTEST
pairs used in the presentation. Splits across multiple slides when the
table exceeds 20 rows.

Closes #1325

Co-authored-by: Ona <no-reply@ona.com>
Use translate_terms() for PPTESTCD→PPTEST lookup so custom codes (e.g.
user-defined ratio PPTESTCDs) appear in the glossary with their code as
the label. Non-parameter column names (Statistic, USUBJID) are filtered
out since they have no metadata match and translate_terms returns them
unchanged.

Co-authored-by: Ona <no-reply@ona.com>
…add_pptx_glossary_slides

- as.character() coerces NULL to character(0) when no slide data exists
- .add_pptx_glossary_slides returns list(pptx, n_slides) so the caller
  does not recompute the slide count independently

Co-authored-by: Ona <no-reply@ona.com>
@Shaakon35 Shaakon35 requested a review from Gero1999 May 27, 2026 09:15
@Shaakon35 Shaakon35 marked this pull request as ready for review May 27, 2026 09:28
@Shaakon35 Shaakon35 requested a review from h5hoang May 27, 2026 12:17

@h5hoang h5hoang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glossary shows up as intended on slide 2 and properly lists only the PPTESTCDs that appear in the rest of the deck, but overflows out of bounds of the slide layout with more params :

image image

as you noted in the reviewer notes, changing the max_rows from 20 to ~8 to should fit within the slide bounds and I think it might be worth considering moving the table up to fill up the whitespace between "Glossary" and the table. But I think it looks good so far ! :)

Shaakon35 and others added 8 commits June 3, 2026 09:54
… overflow

- Use explicit ph_location coordinates in add_pptx_sl_table to position
  title compactly at top (top=0.15) and table right below (top=0.85)
- Reduce glossary max_rows from 20 to 15 to fit within slide bounds

Co-authored-by: Ona <no-reply@ona.com>
… prevent overflow"

This reverts commit 7936fac.

Co-authored-by: Ona <no-reply@ona.com>
- Position glossary table at top=1.2 (was 2.02) to close gap with title
- Reduce glossary max_rows from 20 to 15 to prevent overflow
- Reduce font size by 2pt (11 -> 9) in all PowerPoint flextables

Co-authored-by: Ona <no-reply@ona.com>
Co-authored-by: Ona <no-reply@ona.com>
Co-authored-by: Ona <no-reply@ona.com>
Co-authored-by: Ona <no-reply@ona.com>
Co-authored-by: Ona <no-reply@ona.com>
@Shaakon35

Shaakon35 commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator Author

glossary shows up as intended on slide 2 and properly lists only the PPTESTCDs that appear in the rest of the deck, but overflows out of bounds of the slide layout with more params :

Thanks for the feedback, I implemented the changes :)
@h5hoang

Verify slide creation and default footer for the table/plot slide
functions after the fontsize change to 9pt.

Co-authored-by: Ona <no-reply@ona.com>

@h5hoang h5hoang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now!

image image

just a comment:

  • fontsize(size = 9) in add_pptx_sl_plottable and add_pptx_sl_table affects all existing slide types, not just the glossary, it looks fine so far from my testing cause it's just font size changes, but this is a change from main so might be worth putting in the PR description

@Shaakon35

Copy link
Copy Markdown
Collaborator Author

@KOBANAK or @daviesmeg Could you have a review please? :)

@KOBANAK KOBANAK left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirm it works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: Add PPTESTCD glossary slide to PowerPoint export

3 participants