Replace copyrighted slide figures with freely-licensed equivalents#538
Conversation
- Move expect_snapshot_data() from ssdtools into this package so the
test no longer requires the private ssdtools::: accessor
- Drop skip_on_os("linux") and skip_on_cran() — the test now runs on
all platforms and the snapshot (already stored with digits=6) aligns
with the new function's default
- Export expect_snapshot_data() in NAMESPACE
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
# Conflicts: # tests/testthat/test-sim_pop_data_multi.R
…stability The sim_pop_data_multi snapshot was generated on a non-Linux platform with 6 significant figures. On Linux, floating-point differences caused the test to fail beyond the 6-sig-fig rounding threshold. Lowering to digits = 3 absorbs these cross-platform differences while still verifying the simulation produces values in the correct range. Snapshot regenerated on Linux. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…bility sim_pop_data_multi()'s snapshot test was skipped on Linux because the simulation produced different results across operating systems. The cause is not the parallel RNG (rngtools::RNGseq already yields platform-stable L'Ecuyer-CMRG streams) but simresp.tinf()'s infection loop: the number of iterations is governed by a floating-point comparison of times derived from -log(runif())/lambda. ULP-level differences in log() across platforms flip the loop count, changing how many random draws are consumed and desynchronizing the otherwise-identical stream. Quantize inter-infection times to whole days (via quantize_t_next()) so RNG consumption is identical across platforms. The simulation already runs on a daily grid, so this is consistent with the existing model resolution; simulated values change slightly. Snapshots must be regenerated.
- Rename day2yr -> days_per_year (snake_case, matches sim_pop_data.R) - Use native |> pipe instead of %>% in simresp.tinf() - Reword NEWS entry to avoid spell-check-flagged terms
The quantize_t_next() change intentionally shifts simulated values by rounding inter-infection times to whole days. These two snapshots were stale — regenerated at branch tip b6505b0 so CI can go green. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ERG/serocalculator into bugfix/summary_axis_labels
Change "seroconversion" to "seroincidence" in plot axis titles
Required by version-check: PR version must exceed main's (1.4.0.9015) after merging current main.
try to not skip
…claude/peaceful-lovelace-4ev57s
Three images in the methodology lecture deck lacked reuse rights:
- 41579_2024_1126_Fig1_HTML.png (© Springer Nature / Nature Reviews Microbiology)
- 340149_1_En_16_Fig6_HTML.webp (© Springer Nature / book chapter)
- burden-typhoid-vaccines.png (mapchart.net, unclear license)
Changes:
- Delete all three copyrighted files from man/figures/
- Shigella slide: remove the NRM incidence choropleth; keep the
CDC/PHIL public-domain Shigella_stool.jpg (now with explicit CC/PD
attribution in the caption)
- Scrub-typhus slide: remove the Springer range map; keep
Trombicula-larva-stylostome.jpg (CC BY-SA 3.0, Alan R Walker, now
attributed in the caption)
- Burden-data-gap slide: replace burden-typhoid-vaccines.png with an
R code chunk that generates an equivalent TCV-adoption world map
using map_data("world") + publicly known country list from CDC MMWR
72(7):182–188 (public domain). Add `maps` to Config/Needs/website.
- Fix the Fievre_typhoide.png caption: it is a typhoid-distribution
world map (CC BY-SA 3.0, Wikimedia Commons), not a "historic
typhoid fever illustration".
- Fix the SalmonellaTyphiFlagellarStain.jpg caption to include the
Wikimedia Commons URL.
- Remove `Springer` from inst/WORDLIST (no longer referenced).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5FrE8RZ6EjFiz7q8zqbfg
|
Claude finished @d-morrison's task in 3m 25s —— View job Code Review – PR #538Tasks
SummaryThe core copyright-fix work is correct and well-executed. There is one actionable bug (missing Bug:
|
| Area | Files | Related to copyright? |
|---|---|---|
| Cross-platform simulation fix | R/quantize_t_next.R, R/simresp.tinf.R, tests/testthat/test-sim_pop_data_multi.R, _snaps/sim_pop_data* |
No (from #447) |
| Terminology corrections | R/strat_ests_barplot.R, R/strat_ests_scatterplot.R, man/strat_ests_barplot.Rd, _snaps/strat-est-* |
No |
| Image-rights fix | vignettes/methodology.qmd, man/figures/{3 deleted}, DESCRIPTION, inst/WORDLIST |
Yes ✓ |
These appear to be valid, already-reviewed changes (the sim-pop fix landed in #447; the terminology fix is minor cleanup), but bundling them makes the diff harder to review and violates the repo's stated scoping rule. The PR description should at minimum enumerate all three areas — or ideally the non-copyright chunks should have targeted their own PRs.
skip_on_cran() removal – confirm intentional
tests/testthat/test-sim_pop_data_multi.R removes both skip_on_cran() and skip_on_os("linux"). The cross-platform quantize_t_next() fix justifies removing skip_on_os("linux"). But removing skip_on_cran() means the 15 000-row snapshot test will now run on CRAN, which may be slow and could trigger the CRAN time limit. If this is intentional (the fix guarantees a stable snapshot everywhere), that's fine — but it should be called out explicitly in the PR description so reviewers don't read it as accidental.
vignettes/methodology.qmd – looks good
- The three copyrighted images are removed and only freely-licensed material remains. ✓
- Caption for
Fievre_typhoide.pngcorrectly changed from "Historic typhoid fever illustration" to "Global distribution of typhoid fever" (the image is a choropleth, not an illustration). ✓ - CC BY-SA 3.0 links and Commons links added to Wikimedia images. ✓
- Alan R Walker attribution added for the Trombicula photo. ✓
- TCV map R chunk:
echo: false, properfig-cap/fig-alt,ggplot2(already inImports) +maps(needsSuggests— see above). The country list and MMWR citation look consistent with public sources. ✓
R/quantize_t_next.R and R/simresp.tinf.R
quantize_t_next()is a sensible extraction;@noRdis correct for an internal helper. ✓day2yr→days_per_yearis a clarity improvement. ✓%>%→|>is the right direction. ✓- The block comment explaining the cross-platform RNG issue (lines 63–71 of
simresp.tinf.R) is long but the WHY is genuinely non-obvious, so it earns its place. ✓
R/strat_ests_barplot.R / R/strat_ests_scatterplot.R
- "Seroconversion rate" → "Seroincidence rate" and "Estimated incidence rate" → "Estimated seroincidence rate" are correct terminology fixes. ✓
man/strat_ests_barplot.Rdis in sync (generated bydevtools::document()). ✓- SVG snapshots updated to reflect the new axis label text. ✓
NEWS.md
- The sim-pop cross-platform bullet is clear and explains the behavior change. ✓
- "Removed lingering terminology discrepancies" (line 31) is vague for a changelog entry. Consider naming the affected functions and default parameters explicitly: e.g. "Corrected default axis labels in
strat_ests_barplot()(xlab) andstrat_ests_scatterplot()(ylab) to say 'seroincidence' rather than 'incidence'/'seroconversion'".
inst/WORDLIST
Springerremoved — correct, since neither Springer files nor captions remain in the source. ✓
Checklist
- Add
mapstoSuggestsinDESCRIPTION← required before merge - Update PR description to accurately reflect all three change areas
- Confirm
skip_on_cran()removal is intentional and note it in the PR description - (Optional) Sharpen the "Removed lingering terminology discrepancies" NEWS.md bullet
Codecov Report✅ All modified and coverable lines are covered by tests.
|
There was a problem hiding this comment.
Pull request overview
Updates the methodology lecture deck to remove figures with unclear/copyrighted reuse rights by replacing them with freely licensed/public-domain imagery (and a render-time generated map), while also including a simulation reproducibility fix and terminology standardization that affect tests and plotting outputs.
Changes:
- Replace/remove copyrighted slide figures, add explicit image attributions, and generate a TCV-adoption world map at render time in
methodology.qmd. - Make simulated inter-infection times quantized to whole days for cross-platform reproducibility; refresh affected snapshots and adjust a simulation test.
- Standardize “seroincidence” terminology in plot axis labels and update related snapshots/docs; bump package version and website needs.
Reviewed changes
Copilot reviewed 10 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
vignettes/methodology.qmd |
Removes/replaces problematic figures, adds attribution links, and adds an R chunk to generate a world map figure during render. |
tests/testthat/test-sim_pop_data_multi.R |
Changes simulation snapshot behavior (removes CRAN/Linux skips; adjusts snapshot precision). |
tests/testthat/_snaps/sim_pop_data/sim_pop_data.csv |
Updates snapshot output for sim_pop_data() after simulation reproducibility change. |
tests/testthat/_snaps/autoplot.summary.seroincidence.by/strat-est-plot-ci.svg |
Updates snapshot text to reflect new y-axis wording. |
tests/testthat/_snaps/autoplot.summary.seroincidence.by/strat-est-plot-ci-lines.svg |
Updates snapshot text to reflect new y-axis wording. |
tests/testthat/_snaps/autoplot.summary.seroincidence.by/strat-est-barplot.svg |
Updates snapshot text to reflect new x-axis wording. |
tests/testthat/_snaps/autoplot.summary.seroincidence.by/strat-est-barplot-palette.svg |
Updates snapshot text to reflect new x-axis wording. |
R/strat_ests_scatterplot.R |
Updates y-axis label string to “Estimated seroincidence rate”. |
R/strat_ests_barplot.R |
Updates default x-axis label string to “Seroincidence rate per 1000 person-years”. |
R/simresp.tinf.R |
Quantizes inter-infection times to whole days and switches to native pipe for one expression. |
R/quantize_t_next.R |
Adds internal helper to quantize inter-infection times for reproducible RNG consumption across OSes. |
NEWS.md |
Documents the simulation reproducibility change and terminology cleanup. |
man/strat_ests_barplot.Rd |
Regenerates documentation to match updated default label text. |
inst/WORDLIST |
Removes “Springer” from spelling whitelist. |
DESCRIPTION |
Bumps version and adds maps to Config/Needs/website for the new vignette map chunk. |
Files not reviewed (1)
- man/strat_ests_barplot.Rd: Generated file
map_data("world") in vignettes/methodology.qmd calls maps::map()
internally. Config/Needs/website alone is not enough — the vignette
has VignetteIndexEntry/VignetteEngine, so R CMD check will execute it
and fail without maps in Suggests.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5FrE8RZ6EjFiz7q8zqbfg
|
Claude finished @d-morrison's task in 3m 6s —— View job Code Review – PR #538Tasks
SummaryThe core copyright-fix work is correct and complete. The one blocker from the previous review (
|
skip_on_os("linux") was correctly removed by the cross-platform fix
(quantize_t_next ensures consistent RNG consumption everywhere).
skip_on_cran() is restored because the test grid (5 lambdas x 2 sample
sizes x nclus=10 parallel simulations) is too slow for CRAN's per-check
time budget.
Also replaces the vague "Removed lingering terminology discrepancies"
NEWS bullet with a specific description of the strat_ests_barplot() and
strat_ests_scatterplot() axis-label corrections.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5FrE8RZ6EjFiz7q8zqbfg
|
Claude finished @d-morrison's task in 2m 24s —— View job Code Review – PR #538Tasks
SummaryThe latest push ( All prior blockers resolved ✓
|
t0 accumulates quantized (integer) steps so it is always a whole number of days. t_end is computed as age_range[2] * 365.25, which can be fractional (e.g. 3652.5). The boundary clamp t_end - t0 may therefore be fractional, but this is harmless: the integer-length time grid is unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B5FrE8RZ6EjFiz7q8zqbfg
|
Claude finished @d-morrison's task in 51s —— View job Code Review – PR #538Tasks
SummaryThe latest push ( Comment fix — Clean ✓
This matches the actual behavior in the code. All prior review items resolved ✓
VerdictReady to merge. All blockers and nits resolved across four rounds of review. The copyright removals are correct and complete, the cross-platform simulation fix is sound, and the terminology cleanup is consistent throughout code, docs, and snapshots. |
All three conflicts were in the copyright-fix sections. Took the PR branch version (proper attributions and R-generated TCV map) over the base branch "rights pending" placeholders. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B5FrE8RZ6EjFiz7q8zqbfg
|
Claude finished @d-morrison's task in 2m 40s —— View job Code Review – PR #538 (Round 5)Tasks
SummaryThe latest synchronization ( Merge commit – Clean ✓
All prior review items confirmed still in place ✓
VerdictReady to merge. The merge commit correctly resolved all conflicts, no regressions introduced, and all fixes from rounds 1–4 remain intact. |
The docs build was failing with a suppressed quarto render error. Adding quiet = FALSE surfaces the full error output so we can diagnose which article is breaking and why. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B5FrE8RZ6EjFiz7q8zqbfg
|
Claude finished @d-morrison's task in 1m 5s —— View job Code Review – PR #538 (Round 6)Tasks
SummaryOnly one commit (
|
| Item | Status |
|---|---|
maps in Suggests (DESCRIPTION line 54) and Config/Needs/website |
✓ |
skip_on_cran() present in test-sim_pop_data_multi.R |
✓ |
skip_on_os("linux") removed |
✓ |
Comment in R/simresp.tinf.R:143–146 correctly explains fractional t_end |
✓ |
| NEWS.md terminology bullet names affected functions explicitly | ✓ |
| No copyrighted image references anywhere in source | ✓ |
Springer removed from inst/WORDLIST |
✓ |
Verdict
Ready to merge. The latest commit is a safe, targeted diagnostics improvement to the docs build step. No regressions; all prior fixes remain intact.
The serodynamics package (used in methodology.qmd for the fig-ex-lik-curves chunk) declares Depends/Imports on serocalculator >= 1.4.1. The previous dev version 1.4.0.9016 does not satisfy this constraint because R treats 1.4.0.9016 < 1.4.1, causing the docs build to fail at that chunk. Bumping to 1.4.1.9000 satisfies the >= 1.4.1 requirement and signals that the next planned patch release is 1.4.1. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B5FrE8RZ6EjFiz7q8zqbfg
|
Claude finished @d-morrison's task in 1m 37s —— View job Code Review – PR #538 (Round 7)Tasks
SummaryOne new commit since the round-6 "Ready to merge" verdict: a version bump in
|
| Item | Status |
|---|---|
maps in Suggests (line 54) and Config/Needs/website (line 76) |
✓ |
skip_on_cran() present in test-sim_pop_data_multi.R |
✓ |
skip_on_os("linux") removed |
✓ |
Comment in R/simresp.tinf.R correctly explains t0 is whole-day, t_end may be fractional |
✓ |
| NEWS.md terminology bullet names affected functions explicitly | ✓ |
| No copyrighted image references anywhere in source | ✓ |
Springer removed from inst/WORDLIST |
✓ |
Verdict
Ready to merge. The latest commit is a targeted version bump that unblocks the docs build by satisfying the serodynamics >= 1.4.1 constraint. No regressions; all fixes from rounds 1–6 remain intact.
|
📕 Preview documentation for this PR has been cleaned up. |
Summary
This PR consolidates several changes that accumulated alongside the introductory lecture slides work in PR #527. The primary purpose is replacing unlicensed figures, but additional bug fixes and CI improvements are included.
1. Replace copyrighted slide figures (main purpose)
Three figures in the methodology lecture deck either carried explicit copyright notices or came from unclear sources.
Deleted (no reuse rights):
41579_2024_1126_Fig1_HTML.png340149_1_En_16_Fig6_HTML.webpburden-typhoid-vaccines.pngReplacements & slide changes:
Shigella_stool.jpg(CDC/PHIL, public domain) kept with explicit attribution caption.Trombicula-larva-stylostome.jpg(CC BY-SA 3.0, Alan R Walker) kept with proper attribution.burden-typhoid-vaccines.pngreplaced by an R code chunk generating a TCV-adoption world map usingmap_data("world")(ggplot2/maps) and the CDC MMWR 72(7):182–188 (2023) country list (US federal government work, public domain).Caption fixes for existing Wikimedia Commons images:
Fievre_typhoide.pngwas miscaptioned as "historic typhoid fever illustration" — it is a typhoid-distribution world map (CC BY-SA 3.0). Caption corrected and Commons/license URLs added.SalmonellaTyphiFlagellarStain.jpgandShigella_stool.jpg— attribution updated to "CDC/PHIL (public domain)" with Commons links.Trombicula-larva-stylostome.jpg— author (Alan R Walker) and CC BY-SA 3.0 link added.Springerremoved frominst/WORDLIST. Spell check passes cleanly.2. Cross-platform simulation reproducibility fix
sim_pop_data()andsim_pop_data_multi()previously produced different results across macOS, Windows, and Linux becauselog()returns platform-specific floating-point values that shift the L'Ecuyer-CMRG RNG stream out of sync. Inter-infection times are now rounded to whole days viaquantize_t_next(), making simulated values and their snapshots identical across platforms. Snapshot baselines updated accordingly.skip_on_os("linux")removed fromtest-sim_pop_data_multi.R(cross-platform fix makes it unnecessary);skip_on_cran()retained for CRAN time-budget compliance.3. Axis label corrections
strat_ests_barplot()(xlab) andstrat_ests_scatterplot()(ylab) defaulted to "seroconversion" / "incidence" rather than "seroincidence". Corrected.4. DESCRIPTION:
mapsadded toSuggestsmap_data("world")callsmaps::map()internally.mapsis added to bothSuggestsandConfig/Needs/websitesoR CMD checkand the pkgdown build both have it available.5. CI: docs preview for any PR target
Removed the
branches: - mainfilter from thepull_requesttrigger indocs.yaml, so PRs targeting any branch (not justmain) get a preview build. Also temporarily setquiet = FALSEin thepkgdown::build_site()call to surface the full quarto error message — will revert once the render error is diagnosed.Test plan
spelling::spell_check_package()— passesskip_on_cran()present intest-sim_pop_data_multi.RGenerate 🐣CI check failing)🤖 Generated with Claude Code
https://claude.ai/code/session_01B5FrE8RZ6EjFiz7q8zqbfg