Skip to content

Check unique values of site_pop per site #232

New issue

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

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

Already on GitHub? # to your account

Merged
merged 8 commits into from
Oct 25, 2024
Merged

Check unique values of site_pop per site #232

merged 8 commits into from
Oct 25, 2024

Conversation

gvegayon
Copy link
Member

@gvegayon gvegayon commented Oct 23, 2024

This pull request includes a change enhancing data validation: checks for unique site populations.

Enhancements to data validation:

  • Added a check to ensure that site_pop is unique per site in the validate_ww_conc_data function (R/validate.R).
  • Introduced a new test to verify that the population size per site remains constant (tests/testthat/test_preprocess_ww_data.R).

Documentation updates:

  • Updated NEWS.md to include a note about the new check for unique site_pop values.

Misc

  • Adds the dplyr:: prefix in multiple files (by @kaitejohnson):
    • flag_ww_outliers function in R/preprocessing.R
    • test_preprocess_ww_data.R tests

@gvegayon gvegayon linked an issue Oct 23, 2024 that may be closed by this pull request
Copy link

github-actions bot commented Oct 23, 2024

Thank you for your contribution @gvegayon 🚀! Your github-pages is ready for download 👉 here 👈!
(The artifact expires on 2024-11-01T16:40:16Z. You can re-generate it by re-running the workflow here.)

@gvegayon gvegayon marked this pull request as ready for review October 25, 2024 16:30
@kaitejohnson
Copy link
Contributor

Pending CI passes, this LGTM, TY @gvegayon !

@kaitejohnson kaitejohnson self-requested a review October 25, 2024 16:38
@gvegayon gvegayon merged commit 51b3440 into main Oct 25, 2024
10 checks passed
@gvegayon gvegayon deleted the 226-site_pop-check branch October 25, 2024 17:34
kaitejohnson added a commit that referenced this pull request Nov 11, 2024
* Adding class and methods for wwinference model fit (#58)

* Starting off refactoring (expected to fail) [skip ci]

* Adding new method

* Fixing bug in fit_model (was exploiting scoping)

* Updating docs (fixing S3 methods)

* 49 output class creation (#59)

* add a space

* add first test of first check

* add tests for all of the check/assert functions

* run precommit

* check bug in passing output of checkmate to cliabort

* initial tests of preprocess_ww_data

* add custum utils function for autoescaping brackets to pass to glue

* add a bunch of tests for preprocessing wastewater data

* add one more test of site lab indexing

* fix bugs caught in CI

* fix lab site spacing

* fix spacing in name again

* add test to hospital admissions preprocessing

* add additional test to ensure character to indexing of sites and labs

* remove bug in expected number of unique lab site indices

* add tests to make sure data is daily and test to checkers

* add a bunch of validation checks to the joint datasets and the user specifications

* replace with new way of getting stan data

* fix examples, add test, add warning

* fix examples, add test, add warning

* change from hosp -> count everywhere except stan and  vignette/examples

* add tests for pmfs

* fix bugs in documentation

* add padding value as a function arg

* change pmf size check to a warning not an error

* fix bug

* make initialization function more generic

* update changelog

* modify to test

* fix typo from merge

* fix parsing of cmdstan object

* change parsing of fit obj

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* some tweaks to checkers

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* fix documentation

* fix typo

* fix typo

* change outputs from wwinference() function

* fix typos, add documentation

* fix bug missing stan args

* exclude t columns in data join

* fix vignette bug

* add the ww_output documentation

* document ...

* fix missing comma

* move documentation of params around

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* change syntax and filenames

* Update R/preprocessing.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/wwinference.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/wwinference.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* change naming and internal checking

* change syntax

* move around documentation

* fix check

* fix tests, fix documentation

* rename assert function to specify within a certain frame

* add element to text

* fix bug in function name

* tweak to inference function

* fix two bugs

* adjust tests based on updated get stan data function which breaks up generation of input data

* Update get_stan_data.R example

* update documentation after fixing example

* add example to wwinference wrapper function

* attempt to move around documentation for wwinference methods

* play around with the documentation of the default and the S3 method functions

* export S3 method function

* add back in exporting functions to get input data formatted for stan

* make first argument of function have same name as class object

* fix bug in how max generation time is found

* update vignette to explain wwinference_fit class object vs explicit function calling, add diagnostics and show both ways

* fix naming blocks adding comma when needed

* dont export autoescape brackets function

* fix same bug

* update test and preprocessing to count at LOD values at below LOD

* fix internal call to diagnostic flags function

* Update R/validate.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_preprocess_count_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* implement DMs suggestions

* run pre-commit

* export default functions

* Add test-coverage.yaml from epinowcast

* remove test coverage

* remove example, function not exported

* export default function

* export both diagnostics functions

* add documentation of additional arguments

* Update R/validate.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/validate.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/validate.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_preprocess_count_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_preprocess_ww_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/validate.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* manually input some suggestions

* Update tests/testthat/test_checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_preprocess_count_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_preprocess_count_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_preprocess_count_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* add more checknames

* run pre-commit locally

* fix typo

* add some very minimal tests

* fix wwinference function

* fix bug

* fix bug

* Update tests/testthat/test_preprocess_count_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_preprocess_count_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* run pre-commit locally

* fix bugs in tests

* fix error in tests

* move forecast date, calib time, horizon time to args to wrapper function

* fix hosp only example in vignette

* fix error in example

* add dont run to examples

* check -> expect in checkmate, confirm tests pass locally

---------

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>
Co-authored-by: George G. Vega Yon <g.vegayon@gmail.com>

* Making pre-commit happy

* Reworking cross-references and print method

* Removing copy of fit_model

* Fixing function call

* Addressing PR comments

* Forgot to save some changes

* Change output names (#86)

* change names of outputs of wwinference wrapper function

* fix a few other missed replacements

* fix pre-commit

* Fixing R CMD check

* Pre-commit

* Removing diagnostics_summary

---------

Co-authored-by: George G. Vega Yon <g.vegayon@gmail.com>

* Update vignettes/wwinference.Rmd

Co-authored-by: Kaitlyn Johnson <94390107+kaitejohnson@users.noreply.github.com>

* Update vignettes/wwinference.Rmd

Co-authored-by: Kaitlyn Johnson <94390107+kaitejohnson@users.noreply.github.com>

* Adding example of summary and print in the vignette. Addressing some minor comments

* fix test for expected names after changing function args

* set seed in tests

---------

Co-authored-by: Kaitlyn Johnson <94390107+kaitejohnson@users.noreply.github.com>
Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>
Co-authored-by: kaitejohnson <uox1@cdc.gov>

* Addressing R CMD check notes due to tidyeval syntax (#108)

* Starting to use .data and others

* Removing more warnings

* Think almost all issues are now solved

* License warning and passing params as expected

* Removing  prefix

* Fixing note on license and news file

* Using str2lang in spread_draws

* Update R/get_draws_df.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Fixing R CMD check

* fixed intercept in figures

* Update R/generate_simulated_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Apply suggestions from code review by @dylanhmorris

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/preprocessing.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/get_stan_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/preprocessing.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/preprocessing.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/preprocessing.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/preprocessing.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/preprocessing.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* remove call to utils::globalVariables()

* Update R/preprocessing.R

* Update R/generate_simulated_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/preprocessing.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/get_stan_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

---------

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>
Co-authored-by: Kaitlyn Johnson <94390107+kaitejohnson@users.noreply.github.com>
Co-authored-by: kaitejohnson <uox1@cdc.gov>

* update hierarchical estimate of sigma_site in `model_definition` (#120)

* add a space

* update hierarchical estimate of sigma_site

* update prior table

* run pre-commit

* update comment when transforming to site level standard deviations

* add to change log

* Update inst/stan/wwinference.stan

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update model_definition.md

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update model_definition.md

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update model_definition.md

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* update notation for mode and sd of stdevs

* Update model_definition.md

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update model_definition.md

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update model_definition.md

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* tweaks to formatting

* Update model_definition.md

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

---------

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Vignette tweaks (#141)

* fix typo in indicate ww exclusions documentation

* fix typos/language in vignette

* Update R/preprocessing.R

Co-authored-by: Chirag Kumar <kzs9@cdc.gov>

* update docs

---------

Co-authored-by: Chirag Kumar <kzs9@cdc.gov>

* actually set seed

* Set seeds in test_get_stan_data (#146)

Co-authored-by: Kaitlyn Johnson <94390107+kaitejohnson@users.noreply.github.com>

* Modify package to expect log scale concentration values and LODs (#122)

* Tweaks to model definition (#134)

* Fix check for required wastewater columns (#127)

* Switch to placing prior on and inferring `i/n` at the first observed timepoint (#85)

* update vignette to reflect default NULL seed in mcmcoptions (#125)

* Fix NEWS.md (#126)

* hot fix to readme

* Update NEWS.md

* run pre-commit

* Update NEWS.md (#144)

* run pre-commit locally

* Update NEWS.md

---------

Co-authored-by: George G. Vega Yon <g.vegayon@gmail.com>

* Update DESCRIPTION (#156)

* Adding new class and method for get_draws (#153)

* Adding new class and method (expected to fail)

* Addressing issues with names (expected to fail)

* Adding the what parameter to the docs

* Addressing final bits. Now need the test

* Adding plot method as a wrapper

* Adding some tests

* Fixing test and setting default y=NULL in plot

* Adding some lines in the vignette to explain the plot method works on wwinference_fit_draws

* Addressing review comments

* Typo in length function

* Reverting R/sysdata.rda and ensuring tests run properly

* Reverting sysdata (again)

* Better print and fixing test

* Fixing tests

* Add contributors (#160)

* 163 expand R version  (#164)

* Add hex logo to repo (#148)

* update readme with logo

* swap to svg

* use use package

* adjust size and remove extra text

* try adding new logo

* fix title

* fix title again

* delete old logos

* Various bug fixes (#128)

* fix rendering to katex, add mathcal Rt to vignette (#169)

* Tweaks to main vignette (#170)

* Adding the post-page-artifact job (#181)

* Build link comment in PRs: update comment instead of re-creating on rebuilds (#182)

* Only run post-page-artifact job on PRs (#183)

* Fix formatting so functions link (#179)

* 174 cmdstanr sample args (#175)

* Hot fix validate pmf (#191)

* Restructure hierarchical estimation based on reference subpopulation (#158)

* update validate to warn if sum(site_pop)>total pop

* modify to center around the reference pop

* temporary change to stan file path for troubleshooting

* model compiles

* reorder pops by size, reindex subpops to sites, add switch for include_ww = 0

* wip rmd

* reindex labsites
 + other changes

* ensure the sum(sites)<total_pop case works

* workaround to handle include_ww = 0 in stan data

* add documentation, fix vignette

* fix preprocessing to order by site pop, add a test for this

* add tests for the hosp only and no aux site cases

* add a test of null data being passed in

* tweaks to print methods and get draws function

* tweak diagnostics, make sure hosp logic works as expected

* switch diagnostics, fix inits, add error message if req ww for hosp only model

* update vignette package data

* update test data

* add log shift from reference pop to central dynamic

* add m prior to params and stan data, fix inits bug

* update test data

* fix preprocessing test to order in terms of site pops

* fix model diagnostics functions

* m should be centered around 1!

* fix inits

* m is log scale, it should be centered around 0

* fix inits

* update test data

* edit subpop definition in model defn

* run pre-commit

* fix arrange

* edit model definition to explain reference subpop

* run pre-commit locally

* fix example

* Update inst/stan/wwinference.stan

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update inst/stan/wwinference.stan

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update inst/stan/wwinference.stan

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update inst/stan/wwinference.stan

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update inst/stan/wwinference.stan

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update inst/stan/wwinference.stan

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update inst/stan/wwinference.stan

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* add ofsets to intercept and growth rate of unobserved infection process

* update test data running on WSL2

* Change how offsets are handled (#168)

* Update model file to handle offsets slightly differently, clarify parameter name comments

* Fix missing close paren

* Fix variable name

* Fix more variable names

* Remove separate handling of reference pop, fix a few more bugs

* Update docs

* Fix check for warning in get_stan_data test

* Better fix for test_get_stan_data

* Fail more informatively if test_ww_model fails to fit entirely

* Further customize the fitting failure message for informativeness

* Update get stan data with new variable names

* Add new variable names to example_params.toml

* Fix indexing and initialization

* Update test data

* add test of no ww model

* add conditional for inits, add test for no ww

* tweak prreprocessing to handle no wastewater case, add tests for all cases

* update testing data

* Update R/get_stan_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/get_draws.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/validate.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/validate.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* fix initialization

* update language around the sum(sites)>pop

* run pre-commit locally

* whoops, fix init

* aux site -> aux subpop

* add site_to_subpop map to get_subpop_data function

* create vectors to pass to stan using the subpopulation mappings

* revert to original initialization, use index explicitly in df column name

* remove old comments

* add functions for making spines in wwinference

* move spine functions to get stan data file

* update docs

* fix fxn input

* Fix typo

* refactor handling of sites, subpops, ww data indices interally, commented code, expect to fail

* include lod vals in plots

* fix get stan data to be all based on mappings

* fix tests to take in all inputs to get stan data

* fix lab_site_subpop_spine fxn

* first pass fix postprocessing

* minor tweaks

* update expected column names from get_draws

* update test data

* fix labsite to subpop spine handling, add docs for get ww indices and vals

---------

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>
Co-authored-by: Dylan H. Morris <dzl1@cdc.gov>

* init had wrong name... (#199)

* add multiple os to matrix strategy (#190)

* Update NEWS.md (#205)

* Update README.md (#207)

* Update DESCRIPTION (#203)

* Fix error messaging when data extends beyond forecast date (#208)

* Positive constrain mode_sigma_ww_site (#210)

* Setup pkgdown so it hosts release and dev sites (#212)

* Adding the developer mode (see if it works)

* Updating action to build twice with caching

* Fixing concurrency and workflow graph

* Fixing action

* Wrong option passed to gh release list

* Adding missing token

* Debugging

* Debugging gh release list

* Debugging gh release list v2

* Trying a different strategu

* Trying a different strategy v2

* Using jq to extract the tag info

* Another try

* Printing releases

* Trying a different strategy

* Was using the wrong pipe

* Properly using the caching

* Switching the version

* Adding person in construction icon

* Adding minor tweaks: auto dev mode and rename cache key

* Adding more links to the site and enforcing buit on new _pkgdown config

* Fixing hashing step

* Was pointing to the wrong yml

* Ensuring hashing and usage of _pkgdown.yml

* Leveraging sparse checkout

* Ensuring where the pkg is thrown

* Correcting sed

* Fixing my bash

* Devel is main and adding toggle button

* Issue 200: Modify plot methods (#218)

* fix link (#231)

* Issue 197: rename `validate_both_datasets` function (#219)

* Replacing artifact and setting retention days to 7 (#230)

* Check unique values of site_pop per site (#232)

* Adding validation of records per site

* Updated news

* Addressing co-pilot hallucination

* Explicit call to dplyr::n()

* testing data had multiple site pops per site!

* Better error and adding a test to catch the error.

---------

Co-authored-by: Kaitlyn Johnson <uox1@cdc.gov>

* [Hot fix] test when pop size is not constant was failing (#235)

* Hot fix!

* There was probably a single site!

* Correcting site name

* fix cbind, dont want duplicat column names, use seq_len but differently

* Update NEWS.md

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

---------

Co-authored-by: Kaitlyn Johnson <kej38@georgetown.edu>
Co-authored-by: Kaitlyn Johnson <94390107+kaitejohnson@users.noreply.github.com>
Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Issue 184: Add outputs to `generate_simulated_data()` fxn and package data (#220)

* Issue 238: Fix plot bug (#239)

* swap order of plotting so calib data shows up

* fix plot function

* use `pkgdown` from main

* fix data.R, remove extra docs

* remove package data

---------

Co-authored-by: George G. Vega Yon <g.vegayon@gmail.com>
Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>
Co-authored-by: Chirag Kumar <kzs9@cdc.gov>
Co-authored-by: Dylan H. Morris <dzl1@cdc.gov>
kaitejohnson added a commit that referenced this pull request Nov 14, 2024
* Adding class and methods for wwinference model fit (#58)

* Starting off refactoring (expected to fail) [skip ci]

* Adding new method

* Fixing bug in fit_model (was exploiting scoping)

* Updating docs (fixing S3 methods)

* 49 output class creation (#59)

* add a space

* add first test of first check

* add tests for all of the check/assert functions

* run precommit

* check bug in passing output of checkmate to cliabort

* initial tests of preprocess_ww_data

* add custum utils function for autoescaping brackets to pass to glue

* add a bunch of tests for preprocessing wastewater data

* add one more test of site lab indexing

* fix bugs caught in CI

* fix lab site spacing

* fix spacing in name again

* add test to hospital admissions preprocessing

* add additional test to ensure character to indexing of sites and labs

* remove bug in expected number of unique lab site indices

* add tests to make sure data is daily and test to checkers

* add a bunch of validation checks to the joint datasets and the user specifications

* replace with new way of getting stan data

* fix examples, add test, add warning

* fix examples, add test, add warning

* change from hosp -> count everywhere except stan and  vignette/examples

* add tests for pmfs

* fix bugs in documentation

* add padding value as a function arg

* change pmf size check to a warning not an error

* fix bug

* make initialization function more generic

* update changelog

* modify to test

* fix typo from merge

* fix parsing of cmdstan object

* change parsing of fit obj

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* some tweaks to checkers

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* fix documentation

* fix typo

* fix typo

* change outputs from wwinference() function

* fix typos, add documentation

* fix bug missing stan args

* exclude t columns in data join

* fix vignette bug

* add the ww_output documentation

* document ...

* fix missing comma

* move documentation of params around

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* change syntax and filenames

* Update R/preprocessing.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/wwinference.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/wwinference.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* change naming and internal checking

* change syntax

* move around documentation

* fix check

* fix tests, fix documentation

* rename assert function to specify within a certain frame

* add element to text

* fix bug in function name

* tweak to inference function

* fix two bugs

* adjust tests based on updated get stan data function which breaks up generation of input data

* Update get_stan_data.R example

* update documentation after fixing example

* add example to wwinference wrapper function

* attempt to move around documentation for wwinference methods

* play around with the documentation of the default and the S3 method functions

* export S3 method function

* add back in exporting functions to get input data formatted for stan

* make first argument of function have same name as class object

* fix bug in how max generation time is found

* update vignette to explain wwinference_fit class object vs explicit function calling, add diagnostics and show both ways

* fix naming blocks adding comma when needed

* dont export autoescape brackets function

* fix same bug

* update test and preprocessing to count at LOD values at below LOD

* fix internal call to diagnostic flags function

* Update R/validate.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_preprocess_count_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* implement DMs suggestions

* run pre-commit

* export default functions

* Add test-coverage.yaml from epinowcast

* remove test coverage

* remove example, function not exported

* export default function

* export both diagnostics functions

* add documentation of additional arguments

* Update R/validate.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/validate.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/validate.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_preprocess_count_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_preprocess_ww_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/validate.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* manually input some suggestions

* Update tests/testthat/test_checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_checkers.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_preprocess_count_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_preprocess_count_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_preprocess_count_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* add more checknames

* run pre-commit locally

* fix typo

* add some very minimal tests

* fix wwinference function

* fix bug

* fix bug

* Update tests/testthat/test_preprocess_count_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update tests/testthat/test_preprocess_count_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* run pre-commit locally

* fix bugs in tests

* fix error in tests

* move forecast date, calib time, horizon time to args to wrapper function

* fix hosp only example in vignette

* fix error in example

* add dont run to examples

* check -> expect in checkmate, confirm tests pass locally

---------

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>
Co-authored-by: George G. Vega Yon <g.vegayon@gmail.com>

* Making pre-commit happy

* Reworking cross-references and print method

* Removing copy of fit_model

* Fixing function call

* Addressing PR comments

* Forgot to save some changes

* Change output names (#86)

* change names of outputs of wwinference wrapper function

* fix a few other missed replacements

* fix pre-commit

* Fixing R CMD check

* Pre-commit

* Removing diagnostics_summary

---------

Co-authored-by: George G. Vega Yon <g.vegayon@gmail.com>

* Update vignettes/wwinference.Rmd

Co-authored-by: Kaitlyn Johnson <94390107+kaitejohnson@users.noreply.github.com>

* Update vignettes/wwinference.Rmd

Co-authored-by: Kaitlyn Johnson <94390107+kaitejohnson@users.noreply.github.com>

* Adding example of summary and print in the vignette. Addressing some minor comments

* fix test for expected names after changing function args

* set seed in tests

---------

Co-authored-by: Kaitlyn Johnson <94390107+kaitejohnson@users.noreply.github.com>
Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>
Co-authored-by: kaitejohnson <uox1@cdc.gov>

* Addressing R CMD check notes due to tidyeval syntax (#108)

* Starting to use .data and others

* Removing more warnings

* Think almost all issues are now solved

* License warning and passing params as expected

* Removing  prefix

* Fixing note on license and news file

* Using str2lang in spread_draws

* Update R/get_draws_df.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Fixing R CMD check

* fixed intercept in figures

* Update R/generate_simulated_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Apply suggestions from code review by @dylanhmorris

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/preprocessing.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/get_stan_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/preprocessing.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/preprocessing.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/preprocessing.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/preprocessing.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/preprocessing.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* remove call to utils::globalVariables()

* Update R/preprocessing.R

* Update R/generate_simulated_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/preprocessing.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/get_stan_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

---------

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>
Co-authored-by: Kaitlyn Johnson <94390107+kaitejohnson@users.noreply.github.com>
Co-authored-by: kaitejohnson <uox1@cdc.gov>

* update hierarchical estimate of sigma_site in `model_definition` (#120)

* add a space

* update hierarchical estimate of sigma_site

* update prior table

* run pre-commit

* update comment when transforming to site level standard deviations

* add to change log

* Update inst/stan/wwinference.stan

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update model_definition.md

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update model_definition.md

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update model_definition.md

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* update notation for mode and sd of stdevs

* Update model_definition.md

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update model_definition.md

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update model_definition.md

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* tweaks to formatting

* Update model_definition.md

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

---------

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Vignette tweaks (#141)

* fix typo in indicate ww exclusions documentation

* fix typos/language in vignette

* Update R/preprocessing.R

Co-authored-by: Chirag Kumar <kzs9@cdc.gov>

* update docs

---------

Co-authored-by: Chirag Kumar <kzs9@cdc.gov>

* actually set seed

* Set seeds in test_get_stan_data (#146)

Co-authored-by: Kaitlyn Johnson <94390107+kaitejohnson@users.noreply.github.com>

* Modify package to expect log scale concentration values and LODs (#122)

* Tweaks to model definition (#134)

* Fix check for required wastewater columns (#127)

* Switch to placing prior on and inferring `i/n` at the first observed timepoint (#85)

* update vignette to reflect default NULL seed in mcmcoptions (#125)

* Fix NEWS.md (#126)

* hot fix to readme

* Update NEWS.md

* run pre-commit

* Update NEWS.md (#144)

* run pre-commit locally

* Update NEWS.md

---------

Co-authored-by: George G. Vega Yon <g.vegayon@gmail.com>

* Update DESCRIPTION (#156)

* Adding new class and method for get_draws (#153)

* Adding new class and method (expected to fail)

* Addressing issues with names (expected to fail)

* Adding the what parameter to the docs

* Addressing final bits. Now need the test

* Adding plot method as a wrapper

* Adding some tests

* Fixing test and setting default y=NULL in plot

* Adding some lines in the vignette to explain the plot method works on wwinference_fit_draws

* Addressing review comments

* Typo in length function

* Reverting R/sysdata.rda and ensuring tests run properly

* Reverting sysdata (again)

* Better print and fixing test

* Fixing tests

* Add contributors (#160)

* 163 expand R version  (#164)

* Add hex logo to repo (#148)

* update readme with logo

* swap to svg

* use use package

* adjust size and remove extra text

* try adding new logo

* fix title

* fix title again

* delete old logos

* Various bug fixes (#128)

* fix rendering to katex, add mathcal Rt to vignette (#169)

* Tweaks to main vignette (#170)

* Adding the post-page-artifact job (#181)

* Build link comment in PRs: update comment instead of re-creating on rebuilds (#182)

* Only run post-page-artifact job on PRs (#183)

* Fix formatting so functions link (#179)

* 174 cmdstanr sample args (#175)

* Hot fix validate pmf (#191)

* Restructure hierarchical estimation based on reference subpopulation (#158)

* update validate to warn if sum(site_pop)>total pop

* modify to center around the reference pop

* temporary change to stan file path for troubleshooting

* model compiles

* reorder pops by size, reindex subpops to sites, add switch for include_ww = 0

* wip rmd

* reindex labsites
 + other changes

* ensure the sum(sites)<total_pop case works

* workaround to handle include_ww = 0 in stan data

* add documentation, fix vignette

* fix preprocessing to order by site pop, add a test for this

* add tests for the hosp only and no aux site cases

* add a test of null data being passed in

* tweaks to print methods and get draws function

* tweak diagnostics, make sure hosp logic works as expected

* switch diagnostics, fix inits, add error message if req ww for hosp only model

* update vignette package data

* update test data

* add log shift from reference pop to central dynamic

* add m prior to params and stan data, fix inits bug

* update test data

* fix preprocessing test to order in terms of site pops

* fix model diagnostics functions

* m should be centered around 1!

* fix inits

* m is log scale, it should be centered around 0

* fix inits

* update test data

* edit subpop definition in model defn

* run pre-commit

* fix arrange

* edit model definition to explain reference subpop

* run pre-commit locally

* fix example

* Update inst/stan/wwinference.stan

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update inst/stan/wwinference.stan

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update inst/stan/wwinference.stan

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update inst/stan/wwinference.stan

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update inst/stan/wwinference.stan

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update inst/stan/wwinference.stan

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update inst/stan/wwinference.stan

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* add ofsets to intercept and growth rate of unobserved infection process

* update test data running on WSL2

* Change how offsets are handled (#168)

* Update model file to handle offsets slightly differently, clarify parameter name comments

* Fix missing close paren

* Fix variable name

* Fix more variable names

* Remove separate handling of reference pop, fix a few more bugs

* Update docs

* Fix check for warning in get_stan_data test

* Better fix for test_get_stan_data

* Fail more informatively if test_ww_model fails to fit entirely

* Further customize the fitting failure message for informativeness

* Update get stan data with new variable names

* Add new variable names to example_params.toml

* Fix indexing and initialization

* Update test data

* add test of no ww model

* add conditional for inits, add test for no ww

* tweak prreprocessing to handle no wastewater case, add tests for all cases

* update testing data

* Update R/get_stan_data.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/get_draws.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/validate.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Update R/validate.R

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* fix initialization

* update language around the sum(sites)>pop

* run pre-commit locally

* whoops, fix init

* aux site -> aux subpop

* add site_to_subpop map to get_subpop_data function

* create vectors to pass to stan using the subpopulation mappings

* revert to original initialization, use index explicitly in df column name

* remove old comments

* add functions for making spines in wwinference

* move spine functions to get stan data file

* update docs

* fix fxn input

* Fix typo

* refactor handling of sites, subpops, ww data indices interally, commented code, expect to fail

* include lod vals in plots

* fix get stan data to be all based on mappings

* fix tests to take in all inputs to get stan data

* fix lab_site_subpop_spine fxn

* first pass fix postprocessing

* minor tweaks

* update expected column names from get_draws

* update test data

* fix labsite to subpop spine handling, add docs for get ww indices and vals

---------

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>
Co-authored-by: Dylan H. Morris <dzl1@cdc.gov>

* init had wrong name... (#199)

* add multiple os to matrix strategy (#190)

* Update NEWS.md (#205)

* Update README.md (#207)

* Update DESCRIPTION (#203)

* Fix error messaging when data extends beyond forecast date (#208)

* Positive constrain mode_sigma_ww_site (#210)

* Setup pkgdown so it hosts release and dev sites (#212)

* Adding the developer mode (see if it works)

* Updating action to build twice with caching

* Fixing concurrency and workflow graph

* Fixing action

* Wrong option passed to gh release list

* Adding missing token

* Debugging

* Debugging gh release list

* Debugging gh release list v2

* Trying a different strategu

* Trying a different strategy v2

* Using jq to extract the tag info

* Another try

* Printing releases

* Trying a different strategy

* Was using the wrong pipe

* Properly using the caching

* Switching the version

* Adding person in construction icon

* Adding minor tweaks: auto dev mode and rename cache key

* Adding more links to the site and enforcing buit on new _pkgdown config

* Fixing hashing step

* Was pointing to the wrong yml

* Ensuring hashing and usage of _pkgdown.yml

* Leveraging sparse checkout

* Ensuring where the pkg is thrown

* Correcting sed

* Fixing my bash

* Devel is main and adding toggle button

* Issue 200: Modify plot methods (#218)

* fix link (#231)

* Issue 197: rename `validate_both_datasets` function (#219)

* Replacing artifact and setting retention days to 7 (#230)

* Check unique values of site_pop per site (#232)

* Adding validation of records per site

* Updated news

* Addressing co-pilot hallucination

* Explicit call to dplyr::n()

* testing data had multiple site pops per site!

* Better error and adding a test to catch the error.

---------

Co-authored-by: Kaitlyn Johnson <uox1@cdc.gov>

* [Hot fix] test when pop size is not constant was failing (#235)

* Hot fix!

* There was probably a single site!

* Correcting site name

* fix cbind, dont want duplicat column names, use seq_len but differently

* Update NEWS.md

Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

---------

Co-authored-by: Kaitlyn Johnson <kej38@georgetown.edu>
Co-authored-by: Kaitlyn Johnson <94390107+kaitejohnson@users.noreply.github.com>
Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>

* Issue 184: Add outputs to `generate_simulated_data()` fxn and package data (#220)

* Issue 238: Fix plot bug (#239)

* swap order of plotting so calib data shows up

* fix plot function

* remove free y scale on subpop rt plot (#247)

* Issue 248: Add package workflow diagram to readme (#249)

* add language to readme

* Add files via upload

* Add files via upload

* remove fig

* Add files via upload

* add svg

* delete png

* add package workflow diagram

* run pre-commit locally

* Add files via upload

* Update README.md

* Update README.md

Co-authored-by: George G. Vega Yon <g.vegayon@gmail.com>

---------

Co-authored-by: George G. Vega Yon <g.vegayon@gmail.com>

* Modify priors on `eta_sd` and `inf_feedback` (#236)

* fix merge conflcits

* update package data

* update documentation

* remove extra package data

* fix merge conflicts in change log

* fix merge conflict in model defn

---------

Co-authored-by: George G. Vega Yon <g.vegayon@gmail.com>
Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>
Co-authored-by: Chirag Kumar <kzs9@cdc.gov>
Co-authored-by: Dylan H. Morris <dzl1@cdc.gov>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in wwvals$ww_sampled_times
2 participants