Skip to content

Resolve widget assets from gsm.vizr and migrate the prevalence plot (#589) - #590

Open
Michał Kamiński (michkam89) wants to merge 8 commits into
devfrom
feat-589-vizr-repoint
Open

Michał Kamiński (michkam89) wants to merge 8 commits into
devfrom
feat-589-vizr-repoint

Conversation

@michkam89

@michkam89 Michał Kamiński (michkam89) commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

This PR was drafted by Claude Code using Sonnet 5 and reviewed by Michał Kamiński (@michkam89)

Resolve widget assets from gsm.vizr and migrate the prevalence plot (#589)

Summary

Moves widget assets from the undeclared gsm.kri coupling to the declared gsm.vizr dependency, and replaces the prevalence ggplot2 chart with gsm.vizr::bars().

Closes #589

Changes

  • gsmDependencies() now loads widget YAML, JS, CSS, and bundles from gsm.vizr. gsm.kri remains in Imports for 14 unrelated live calls.
  • main.css now loads for all four widgets. It is byte-identical to the previous stylesheet and produced no visual change in baseline comparison.
  • The widget renderer moves from gsm.kri@main's 2.3.0 bundle to gsm.vizr 2.4.1.
  • The prevalence chart now uses dodged bars. Stacking would incorrectly combine three independently normalized VizLevel series; dodge preserves comparison without implying a combined total.
  • interactive = FALSE prevents users switching to the invalid stacked presentation.
  • gsm.vizr is temporarily pinned to Gilead-Public/gsm.vizr@for-gsm.app-589. The pointer branch avoids conflicting gsm.core refs during pak resolution and should revert to dev/main after gsm.vizr 0.1.0 lands.
  • Removed unused ggplot2 and scales imports.
  • Fixed prevalence segment labels showing literal .0%; they now use the correct format key and render values such as 49%.

Reviewer notes

  • R version: gsm.vizr requires R >= 4.1, while gsm.app declares R >= 4.0. This needs a maintainer decision and is not resolved here.
  • Known upstream formatting gaps: value-axis ticks and tooltips still display decimal fractions. gsm.viz does not currently support the required formatting for this dodged chart. The correct axis format remains in the spec for forward compatibility.
  • Layout: the prevalence chart height changes from 400px to 500px because barsOutput() uses a different htmlwidgets default.
  • Generated documentation: 34 man/*.Rd files changed because devtools::document() used roxygen2 8.0.0 instead of 7.3.3; these changes are non-functional.
  • Snapshot drift: mod_dfDomains.md and srvr_PluginHelpers.md changed because of environment/rlang drift, not this implementation.

Validation

  • Added tests for gsm.vizr asset resolution, dependency identity, stylesheets, exclusions, prevalence data/spec generation, and percentage-format keys.
  • devtools::check(): 0 errors, 0 warnings, 1 worktree-only .git NOTE that does not occur in a normal clone.
  • Playwright confirmed:
    • all four Metric Details widgets render;
    • selection synchronization and the ["All"] sentinel match baseline behavior;
    • three of four widget canvases are byte-identical under the same selection;
    • the prevalence card renders as a gsm.vizr::bars() widget with a legend and no stacking toggle.

@jharmon-gilead

Jon Harmon (jharmon-gilead) commented Aug 20, 2026 •

Copy link
Copy Markdown

I know the bullet charts on Domain Details were the result of a lotttttttt of back-and-forth/discussion. Is the change acceptable, Jeremy Wildfire (@jwildfire) ?

https://rinpharma.shinyapps.io/gsm-app-pr-590/
vs
https://rinpharma.shinyapps.io/gsm-app/

For example:

  1. (load each site)
  2. Select site 0X4389
  3. Select participant S47584
  4. Go to Domain Details
  5. Turn on all of Study/Site/Participant
  6. Switch to Toxicity Grade for more bars.

@samussiah

Copy link
Copy Markdown
Collaborator

Nice work getting this running Michał Kamiński (@michkam89). I'd suggest the following configuration tweaks:

  • Set position to 'layered' to nest the bars, which should emulate the existing functionality more closely.
  • Set tooltip.format to 'count+percent'.
  • Multiply the prevalence scale by 100 to display percentages.
  • Disable segment labels.
  • Rotate the categorical tick labels by 45°.

We probably have to live without the percentage annotations and lean on the prevalence axis tick lines. To Jon Harmon (@jonthegeek)'s point if we can get the features above implemented we should be able to deliver a nearly identical user experience.

@michkam89

Michał Kamiński (michkam89) commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks both - Spencer Childress (@samussiah), if I understand correctly tooltip.format = 'count+percent'
derives the percentage as value ÷ sum of every series at the category. That's right for a
stacked part-of-whole chart, but doesn't fit the bullet chart: each series is normalised
against its own base (Study 63/100, Site 21/31, Participant 7/9), so there's no total to
take a share of.

'count+percent' on category Other - note the three percentages sum to exactly 100,
against a denominator that doesn't exist, and the count half prints unrounded:

image

Participant: 77.77777777777779 (37.3%)
Group: 67.74193548387096 (32.5%)
Study: 63 (30.2%)

What we could do instead:

A. format = "count", rounding in R -> Participant: 77.8 (no % sign)
B. custom formatter via js_hook() -> Participant: 77.8% (n = 7)

What do you think?

@michkam89

Copy link
Copy Markdown
Contributor Author

Jon Harmon (@jharmon-gilead) Jeremy Wildfire (@jwildfire) what we are also violating in this PR are a few acceptance criteria from #496 (5, 8 and 11) - "displays a label with the numeric % of each value" for Study / Group / Participant, and partly 12–14 which toggle "the bar and label".

Originally the labels sat in a fixed column on the right and were constantly visible.
gsm.viz anchors labels to the bar and has no off-bar placement, and once the bars nest they all land on one centre line - so the % moves to hover only.

Do we accept retiring those?

@jharmon-gilead

Copy link
Copy Markdown

Originally the labels sat in a fixed column on the right and were constantly visible. gsm.viz anchors labels to the bar and has no off-bar placement, and once the bars nest they all land on one centre line - so the % moves to hover only.

Do we accept retiring those?

I think it's better UI for them to be visible without the hover (easier to understand at a glance), but I doubt it will stop acceptance. Jeremy Wildfire (@jwildfire) should we have Jenn/Gosia way in?

@samussiah

Copy link
Copy Markdown
Collaborator

Thanks both - Spencer Childress (Spencer Childress (@samussiah)), if I understand correctly tooltip.format = 'count+percent' derives the percentage as value ÷ sum of every series at the category. That's right for a stacked part-of-whole chart, but doesn't fit the bullet chart: each series is normalised against its own base (Study 63/100, Site 21/31, Participant 7/9), so there's no total to take a share of.

'count+percent' on category Other - note the three percentages sum to exactly 100, against a denominator that doesn't exist, and the count half prints unrounded:

image Participant: 77.77777777777779 (37.3%) Group: 67.74193548387096 (32.5%) Study: 63 (30.2%)

What we could do instead:

A. format = "count", rounding in R -> Participant: 77.8 (no % sign) B. custom formatter via js_hook() -> Participant: 77.8% (n = 7)

What do you think?

I'd go with the custom formatter - forgot these numbers are derived in gsm.app. I'd include both percentage and count.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The code looks good! As long as everything else from discussions is resolved, this looks ready to go!

This branch has not been deployed

No deployments
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.

Migrate barcharts to gsm.vizr and drop the system.file() coupling to gsm.kri's bundle

3 participants