epiforecasts / scoringutils

Utilities for Scoring and Assessing Predictions
https://epiforecasts.io/scoringutils/
Other
48 stars 20 forks source link

Make scoringutils paper a package Vignette #796

Closed nikosbosse closed 3 weeks ago

nikosbosse commented 4 months ago

Description

This PR closes #784.

The PR

Including the paper as a vignette is a lot harder than I imagined and as a result of that this is a bit of a terrible PR.

TLDR:

The broader context is that Vignettes are rendered in the package, as well as on the website via pkgdown. - The package Vignettes can be a pdf and using the existing manuscript works fine. However, pkgdown mostly only accepts HTML files. Rendering the current vignette as an HTML doesn't work well because it uses a lot of LaTeX.

This is where my terrible approach comes from: download the pdf file from the internet when building the vignette. I assume (hope?) this will work on CRAN because I upload the source file. Not sure about github CI and whether that has access to the internet. In any case, the file will have the link to GitHub so people can access everything.

Potential alternative What we could do (inspired by the forecast package (site, _pkgdown.yml)) is the following:

This is basically what the forecast package did. They also managed to include the paper as a PDF package vignette. My theory is this:

[Describe the changes that you made in this pull request.]

Checklist

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.62%. Comparing base (948f251) to head (72ebb06). Report is 10 commits behind head on main.

:exclamation: Current head 72ebb06 differs from pull request most recent head 7f9e516. Consider uploading reports for the commit 7f9e516 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #796 +/- ## ========================================== + Coverage 95.60% 95.62% +0.02% ========================================== Files 21 21 Lines 1569 1577 +8 ========================================== + Hits 1500 1508 +8 Misses 69 69 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

nikosbosse commented 4 months ago
image

~Oh well this fails on CI and I don't know why... It works locally on my machine... Maybe something to do with pdfpages...~

EDIT: the failure comes from the fact that all other vignettes are compiled to HTML and github actions don't install tinytex by default. I updated the github actions yaml.

Next issue:

checking sizes of PDF files under ‘inst/doc’ ... WARNING
    ‘gs+qpdf’ made some significant size reductions:
       compacted ‘scoringutils-paper.pdf’ from 1002Kb to 505Kb
    consider running tools::compactPDF(gs_quality = "ebook") on these files

The vignette file is too big. Folloing the suggestions on SO, I added an additional argument to run compression to the build args. It doesn't really work I'm afraid.