Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second merge of main to spatial-main #246

Merged
merged 47 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
9e39623
Adding class and methods for wwinference model fit (#58)
gvegayon Aug 30, 2024
257587b
Addressing R CMD check notes due to tidyeval syntax (#108)
gvegayon Sep 3, 2024
3a26b38
update hierarchical estimate of sigma_site in `model_definition` (#120)
kaitejohnson Sep 3, 2024
03c9030
Vignette tweaks (#141)
kaitejohnson Sep 4, 2024
4dc56d5
actually set seed
kaitejohnson Sep 5, 2024
80ea140
Set seeds in test_get_stan_data (#146)
dylanhmorris Sep 5, 2024
e7d2b9a
Modify package to expect log scale concentration values and LODs (#122)
kaitejohnson Sep 5, 2024
6df32c5
Tweaks to model definition (#134)
kaitejohnson Sep 6, 2024
6aed488
Fix check for required wastewater columns (#127)
kaitejohnson Sep 6, 2024
978c951
Switch to placing prior on and inferring `i/n` at the first observed …
dylanhmorris Sep 6, 2024
b3acddb
update vignette to reflect default NULL seed in mcmcoptions (#125)
kaitejohnson Sep 6, 2024
ca8e785
Fix NEWS.md (#126)
kaitejohnson Sep 9, 2024
494ea88
Update DESCRIPTION (#156)
kaitejohnson Sep 10, 2024
bd05d1a
Adding new class and method for get_draws (#153)
gvegayon Sep 12, 2024
50120bf
Add contributors (#160)
kaitejohnson Sep 12, 2024
40a9182
163 expand R version (#164)
kaitejohnson Sep 13, 2024
83a4202
Add hex logo to repo (#148)
kaitejohnson Sep 14, 2024
7a615c8
Various bug fixes (#128)
kaitejohnson Sep 16, 2024
fa2ba17
fix rendering to katex, add mathcal Rt to vignette (#169)
kaitejohnson Sep 17, 2024
65c3588
Tweaks to main vignette (#170)
kaitejohnson Sep 17, 2024
9b0937b
Adding the post-page-artifact job (#181)
gvegayon Sep 23, 2024
0137a96
Build link comment in PRs: update comment instead of re-creating on r…
dylanhmorris Sep 24, 2024
745dfe0
Only run post-page-artifact job on PRs (#183)
dylanhmorris Sep 24, 2024
bd3bb65
Fix formatting so functions link (#179)
kaitejohnson Sep 26, 2024
b0287ab
174 cmdstanr sample args (#175)
kaitejohnson Sep 27, 2024
46e896b
Hot fix validate pmf (#191)
kaitejohnson Sep 28, 2024
d35647e
Restructure hierarchical estimation based on reference subpopulation …
kaitejohnson Sep 30, 2024
1a60036
init had wrong name... (#199)
kaitejohnson Oct 1, 2024
452c9f7
add multiple os to matrix strategy (#190)
kaitejohnson Oct 2, 2024
5a52e59
Update NEWS.md (#205)
kaitejohnson Oct 2, 2024
d6d3192
Update README.md (#207)
kaitejohnson Oct 2, 2024
bf2ce80
Update DESCRIPTION (#203)
kaitejohnson Oct 2, 2024
49b6c0f
Fix error messaging when data extends beyond forecast date (#208)
kaitejohnson Oct 2, 2024
9dd766b
Positive constrain mode_sigma_ww_site (#210)
dylanhmorris Oct 4, 2024
629a9c0
Setup pkgdown so it hosts release and dev sites (#212)
gvegayon Oct 15, 2024
c89b13f
Issue 200: Modify plot methods (#218)
kaitejohnson Oct 23, 2024
951a9e4
fix link (#231)
kaitejohnson Oct 23, 2024
e2e4fa1
Issue 197: rename `validate_both_datasets` function (#219)
kaitejohnson Oct 23, 2024
ea85773
Replacing artifact and setting retention days to 7 (#230)
gvegayon Oct 23, 2024
51b3440
Check unique values of site_pop per site (#232)
gvegayon Oct 25, 2024
3e58bec
[Hot fix] test when pop size is not constant was failing (#235)
gvegayon Oct 30, 2024
3ff2d1e
Issue 184: Add outputs to `generate_simulated_data()` fxn and package…
kaitejohnson Oct 31, 2024
afb9594
Issue 238: Fix plot bug (#239)
kaitejohnson Nov 4, 2024
f5495b3
fix merge conflicts
kaitejohnson Nov 5, 2024
7c75349
use `pkgdown` from main
kaitejohnson Nov 5, 2024
39570b0
fix data.R, remove extra docs
kaitejohnson Nov 5, 2024
3c5853a
remove package data
kaitejohnson Nov 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 139 additions & 32 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [main, prod]
pull_request:
branches: [spatial-main, main, prod]
branches: [main, prod]
release:
types: [published]
workflow_dispatch:
Expand All @@ -13,56 +13,171 @@ name: pkgdown

jobs:
build:

strategy:
matrix:
version:
- 'release'
- 'devel'

name: pkgdown site build (${{ matrix.version }})

runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}-${{ matrix.version }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
id-token: write
pages: write
outputs:
page_artifact_id: ${{ steps.upload-artifact.outputs.artifact_id }}
steps:

##########################################################################
# Identifying the latest and corresponding tag/sha to download
#########################################################################
- name: Check the repo to download
id: commit
run: |

gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/CDCgov/ww-inference-model/releases/latest > \
latest_release

echo -n "This job is running on tag/sha: "
if [ "${{ matrix.version }}" = "release" ]; then
echo $(jq -r '.tag_name' latest_release)
echo "tag=$(jq -r '.tag_name' latest_release)" >> $GITHUB_OUTPUT
else
echo "tag=${{ github.sha }}" >> $GITHUB_OUTPUT
echo ${{ github.sha }}
fi

- uses: actions/checkout@v4
with:
ref: ${{ steps.commit.outputs.tag }}

- name: Checkout the sha-associated repo
if: ${{ matrix.version == 'release' }}
uses: actions/checkout@v4
with:
sparse-checkout: './_pkgdown.yml'
path: pkgdown-${{ github.sha}}

- name: Overwriting the _pkgdown.yml
if: ${{ matrix.version == 'release' }}
run: |
cp pkgdown-${{ github.sha }}/_pkgdown.yml ./
rm -rf pkgdown-${{ github.sha }}

- name: Checking if the release is cached
if: ${{ matrix.version == 'release' }}
id: cache-hit
uses: actions/cache@v3
with:
key: pkgdown_site-${{ matrix.version }}-${{ steps.commit.outputs.tag }}-${{ hashFiles( './_pkgdown.yml' ) }}
path: './docs/'

# These steps only happen if the cache is not hit
- uses: r-lib/actions/setup-pandoc@v2
if: ${{ matrix.version != 'release' || steps.cache-hit.outputs.cache-hit != 'true' }}
with:
pandoc-version: "2.19.2"

- uses: r-lib/actions/setup-r@v2
if: ${{ matrix.version != 'release' || steps.cache-hit.outputs.cache-hit != 'true' }}
with:
r-version: "release"
use-public-rspm: true
install-r: false
extra-repositories: "https://mc-stan.org/r-packages/"
- uses: r-lib/actions/setup-r-dependencies@v2
if: ${{ matrix.version != 'release' || steps.cache-hit.outputs.cache-hit != 'true' }}
with:
pak-version: rc
extra-packages: any::pkgdown local::.
needs: website

- name: "Install cmdstan via cmdstanr"
uses: epinowcast/actions/install-cmdstan@v1
if: ${{ matrix.version != 'release' || steps.cache-hit.outputs.cache-hit != 'true' }}
with:
cmdstan-version: "latest"

- name: Build site
run: "pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)"
shell: Rscript {0}
if: ${{ matrix.version != 'release' || steps.cache-hit.outputs.cache-hit != 'true' }}
run: |
# Changing the URL if it is a development build
if [ "${{ matrix.version }}" = "devel" ]; then
# Forcing the development mode
export PKGDOWN_DEV_MODE="devel"
else

# Setting the url
sed -i'' 's|url: https://cdcgov.github.io/ww-inference-model/|url: https://cdcgov.github.io/ww-inference-model/release/|' _pkgdown.yml

# Changing the navbar
sed -i'' 's|href: https://cdcgov.github.io/ww-inference-model/release|href: https://cdcgov.github.io/ww-inference-model/|' _pkgdown.yml

sed -i'' 's|text: (switch to release)|text: (switch to dev)|' _pkgdown.yml

sed -i'' 's|icon: fa-toggle-on|icon: fa-toggle-off|' _pkgdown.yml

# Forcing the release mode
export PKGDOWN_DEV_MODE="release"
fi
Rscript --vanilla -e \
"pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)"

if [ "${{ matrix.version }}" = "devel" ]; then
mv docs docs-tmp
mkdir docs
mv docs-tmp/dev/* docs
fi

- name: Upload artifact for GH pages deployment
id: upload-artifact
uses: actions/upload-artifact@v4
with:
path: "./docs/"
name: pkgdown-site-${{ matrix.version }}

combine:
outputs:
page_artifact_id: ${{ steps.upload-artifact.outputs.artifact_id }}

runs-on: ubuntu-latest
needs: build
steps:

- name: Download dev artifact
uses: actions/download-artifact@v4
with:
name: pkgdown-site-devel
path: ./docs/

- name: Download release artifacts
uses: actions/download-artifact@v4
with:
name: pkgdown-site-release
path: ./docs/release

- name: Upload pages artifact
id: upload-artifact
uses: actions/upload-pages-artifact@v3
with:
path: "docs/"
path: ./docs/
name: github-pages
retention-days: 7

deploy:
# check builds on PRs but only deploy when main changes
if: ${{ github.event_name != 'pull_request' }}
needs: build
needs: combine
runs-on: ubuntu-latest
permissions:
pages: write
Expand All @@ -77,31 +192,23 @@ jobs:
uses: actions/deploy-pages@v4

post-page-artifact:
# only comment on PRs
if: ${{ github.event_name == 'pull_request' }}
needs: build
runs-on: ubuntu-latest

if: ${{ github.event_name == 'pull_request' }}

# This job depends on the `build` job
needs: combine

# Required permissions
permissions:
contents: read
pull-requests: write
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Find Comment
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Your page is ready to preview
contents: read
pull-requests: write

- name: Create or update comment
uses: peter-evans/create-or-update-comment@v4
steps:
# Post the artifact pulling the id from the `readme` step.
# The msg will refer to the arfitact as 'README file'.
- name: Post the artifact
uses: CDCgov/cfa-actions/[email protected]
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Thank you for your contribution, @${{ github.triggering_actor }} :rocket:! Your page is ready to preview [here](https://github.com/${{github.repository}}/actions/runs/${{ github.run_id }}/artifacts/${{ needs.build.outputs.page_artifact_id }})
edit-mode: replace
artifact-name: github-pages
gh-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: wwinference
Title: Jointly infers infection dynamics from wastewater data and epidemiological indicators
Version: 0.1.0
Version: 0.1.0.99
Authors@R: c(
person(given = "Kaitlyn",
family = "Johnson",
Expand Down
15 changes: 15 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@

# wwinference 0.1.0.99 (dev)

## User-visible changes
- Add wastewater data into the forecast period to output in `generate_simulated_data()` function and as package data. Also adds subpopulation-level
hospital admissions to output of function and package data. ([#184](https://github.com/CDCgov/ww-inference-model/issues/184))
- `wwinference` now checks whether `site_pop` is fixed per site (see issue [#223](https://github.com/CDCgov/ww-inference-model/issues/226) reported by [@akeyel](https://github.com/akeyel)).

## Internal changes
- Updated the workflow for posting the pages artifact to PRs (issue [#229](https://github.com/CDCgov/ww-inference-model/issues/229)).
- Modify `plot_forecasted_counts()` so that it does not require an evaluation dataset ([#218](https://github.com/CDCgov/ww-inference-model/pull/218))

# wwinference 0.1.0

This is the first major release, focused on providing an initial version of the package.
Expand All @@ -10,4 +22,7 @@ As it's written, the package is intended to allow users to do the following:
- Validate input data validation with informative error messaging ([#37](https://github.com/CDCgov/ww-inference-model/issues/37), [#54](https://github.com/CDCgov/ww-inference-model/issues/54))
- Provide a wrapper function to generate forward simulated data with user-specified variables. It calls a number of functions to perform specific model components ([#27](https://github.com/CDCgov/ww-inference-model/issues/27))
- Contains S3 class methods applied to the output of the main model wrapper function, the `wwinference_fit` class object ([#58](https://github.com/CDCgov/ww-inference-model/issues/58)).
<<<<<<< HEAD
- Wastewater concentration data is expected to be in log scale ([#122](https://onetakeda.box.com/s/pju273g5khx3y3cwoae2zwv3e7vu03x3)).
=======
- Wastewater concentration data is expected to be in log scale ([#122](https://github.com/CDCgov/ww-inference-model/pull/122)).
29 changes: 20 additions & 9 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@
#' units of log estimated genome copies per mL.}
#' \item{site_pop}{The population size of the wastewater catchment area
#' represented by the site variable}
#' \item{location}{ A string indicating the location that all of the
#' data is coming from. This is not a necessary column, but instead is
#' included to more realistically mirror a typical workflow}
#' }
#' @source vignette_data.R
"ww_data"




#' Example wastewater dataset with independent site correlations.
#'
#' A dataset containing the simulated wastewater concentrations
Expand Down Expand Up @@ -135,9 +137,9 @@
#' to match this format.
#'
#' This data is generated via the default values in the
#' `generate_simulated_data()` function. They represent the bare minumum
#' `generate_simulated_data()` function. They represent the bare minimum
#' required fields needed to pass to the model, and we recommend that users
#' try to format their own data to match this formate.
#' try to format their own data to match this format.
#'
#' The variables are as follows:
#' \describe{
Expand All @@ -147,6 +149,9 @@
#' hospital on that date, available as of the forecast date}
#' \item{state_pop}{The number of people contributing to the daily hospital
#' admissions}
#' \item{location}{ A string indicating the location that all of the
#' data is coming from. This is not a necessary column, but instead is
#' included to more realistically mirror a typical workflow}
#' }
#' @source vignette_data.R
"hosp_data_ind"
Expand Down Expand Up @@ -214,13 +219,19 @@



#' Example hospital admissions dataset for evaluation spatially ind. sites.
#' Example subpopulation level hospital admissions dataset
#'
#' A dataset containing the simulated daily hospital admissions that the model
#' will be evaluated against (labeled here as `daily_hosp_admits_for_eval`)
#' by date of admission (`date`). This data is not needed to fit the model,
#' but is used in the Getting Started vignette to demonstrate the forecasted
#' hospital admissions compared to those later observed.
#' A dataset containing the simulated daily hospital admissions
#' (labeled here as `daily_hosp_admits`) by date of admission (`date`) in
#' each subpopulation.
#' Additional columns that are the population size of the
#' population contributing to the hospital admissions. In this instance,
#' the subpopulations here are each of the wastewater catchment areas plus
#' an additional subpopulation for the portion of the population not captured
#' by wastewater surveillance. The data generated are daily hospital
#' admissions but they could be any other epidemiological count dataset e.g.
#' cases. This data should only contain hospital admissions that would have
#' been available as of the date that the forecast was made.
#'
#' This data is generated via the default values in the
#' `generate_simulated_data()` function.
Expand Down
Loading
Loading