Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Upstream dev to inference #432

Open
wants to merge 138 commits into
base: inference
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
cf5430a
setup file for international countries
shauntruelove May 15, 2020
4a8b97c
Fatiguing NPI
May 18, 2020
f3de4fc
tested MVP
May 18, 2020
51217a6
other implementation, maybe cleaner
May 18, 2020
ecb1263
update to hosp_run to take specified geoid-params
shauntruelove May 18, 2020
1f8c29f
Added mild infections as output of hospitalization
shauntruelove May 18, 2020
4c5a1df
minor
shauntruelove May 18, 2020
3e67086
Hospitalization package update
shauntruelove May 18, 2020
c0651ec
dev setup
May 20, 2020
428fa18
fixed rate
May 20, 2020
7db74be
international seeding and setup files created
shauntruelove May 21, 2020
05dd0df
Update to report template docs for country reports
shauntruelove May 24, 2020
3bd6900
update to non-US scripts
shauntruelove May 25, 2020
0d509f8
Merge branch 'dev' into dev-fatiguingNPI
jkamins7 May 26, 2020
c134d76
update to international branch country setup
shauntruelove May 27, 2020
4b65fac
redirect to covid19_minimal (#301)
eclee25 May 27, 2020
fcaa743
non-US setup Rmd and other scripts finished.
shauntruelove May 27, 2020
544206f
update
shauntruelove May 27, 2020
624534b
minor print edit
shauntruelove May 28, 2020
1543be6
Merge branch 'international' of https://github.com/HopkinsIDD/COVIDSc…
shauntruelove May 28, 2020
ec9c0ac
updates to script to make international functional with master
shauntruelove May 28, 2020
b6b903a
Merge branch 'international' of https://github.com/HopkinsIDD/COVIDSc…
shauntruelove May 28, 2020
1a78e88
minor update to report and setup scripts
shauntruelove May 29, 2020
6f6dc44
setup fix
shauntruelove May 29, 2020
231e1ef
non-us update
shauntruelove May 29, 2020
1771d12
dev setup relative min
May 30, 2020
1421bfe
relative min ready
May 30, 2020
5498faf
Merge branch 'dev-fatiguingNPI' of https://github.com/HopkinsIDD/COVI…
May 30, 2020
fa5d37f
1. Added integration tests for US and non-US create_seeding.R and bui…
shauntruelove Jun 1, 2020
8303cb5
Delete jhucsse_case_data_crude.csv
shauntruelove Jun 1, 2020
08ca5ad
vignette fix
shauntruelove Jun 2, 2020
28bd4f9
Removed man folders from packages
shauntruelove Jun 2, 2020
7f3364a
fixes in the international branch before the merge
shauntruelove Jun 2, 2020
e5fe6a1
Merge branch 'dev' into international
jkamins7 Jun 2, 2020
50f07de
Do not update packages
kkintaro Jun 2, 2020
4697aa8
Update covidImportation to v1.6.1
kkintaro Jun 2, 2020
e45ad2c
minor fix
shauntruelove Jun 3, 2020
6b5f231
update to international
shauntruelove Jun 3, 2020
2feac98
fix non-US setup
shauntruelove Jun 3, 2020
742e385
Update local_install.R
kkintaro Jun 3, 2020
fd7f389
Merge pull request #331 from HopkinsIDD/dev-bug
jkamins7 Jun 3, 2020
1cecf8d
Merge branch 'dev' into dev-fatiguingNPI
jkamins7 Jun 3, 2020
0d3d148
Fix merge error
shauntruelove Jun 3, 2020
6309802
Reload covidImportation v1.6.1 to fix tidyverse dependency
kkintaro Jun 3, 2020
e84faaa
Merge branch 'dev' into dev-bug
kkintaro Jun 3, 2020
ec7f5cd
Merge pull request #332 from HopkinsIDD/dev-bug
jkamins7 Jun 4, 2020
a1f6efb
seeding update with inputted incidence multiplier
shauntruelove Jun 4, 2020
b4234ff
minor names fix
shauntruelove Jun 4, 2020
661fdfd
Minor fixes to build_US and build_nonUS integration tests
kkintaro Jun 4, 2020
c710de5
Merge branch 'dev' into dev-fatiguingNPI
Jun 5, 2020
2f8007e
Merge pull request #312 from HopkinsIDD/dev-fatiguingNPI
jkamins7 Jun 6, 2020
ae0b585
deleted a comma
shauntruelove Jun 8, 2020
68e3ea0
minor bug fix
shauntruelove Jun 8, 2020
0704d06
Fix reversed international tag
shauntruelove Jun 8, 2020
9ce9cd7
fixed error message
shauntruelove Jun 8, 2020
6ab865c
fixed python error
shauntruelove Jun 8, 2020
435c99d
Merge branch 'dev' into international
shauntruelove Jun 9, 2020
ffd74c0
minor
shauntruelove Jun 9, 2020
d354618
Adding updated severity parameters
shauntruelove Jun 9, 2020
13927ed
fixing US seeding
shauntruelove Jun 9, 2020
1654e59
adding print message
shauntruelove Jun 9, 2020
546711d
Update covidImportation with bug fix
kkintaro Jun 9, 2020
dce64d4
minor update
shauntruelove Jun 15, 2020
7dce691
Fix filter issue
shauntruelove Jun 17, 2020
1480df2
integration testing fixes
shauntruelove Jun 17, 2020
4c88fbd
Non-US makefile added. This should actually work fine for US as well.…
shauntruelove Jun 17, 2020
b410acd
make_makefile.R now includes both US and non-US functionality
shauntruelove Jun 17, 2020
99250e1
make_makefile white space fix
shauntruelove Jun 17, 2020
79d8e46
Merge pull request #330 from HopkinsIDD/international
jkamins7 Jun 17, 2020
12e789f
Add tictoc package to dev docker
kkintaro Jul 9, 2020
f783659
Merge pull request #347 from HopkinsIDD/dev-tictoc
jkamins7 Jul 9, 2020
92df34e
Updated to fix a docker bug
jkamins7 Jul 8, 2020
98af123
Merge branch 'dev' into dev-setuptools
kkintaro Jul 10, 2020
6bc18b4
Merge pull request #348 from HopkinsIDD/dev-setuptools
jkamins7 Jul 10, 2020
4b336a5
Report devel2 into dev (#352)
eclee25 Jul 15, 2020
86e29bd
configurable delay and ratio for seeding
eclee25 Jul 18, 2020
0a9cb3b
seeding file extra comma
eclee25 Jul 18, 2020
0a357f7
change path to report.generation
eclee25 Jul 18, 2020
8eec143
rm double parens
eclee25 Jul 18, 2020
de6bb35
Dev make (#358)
eclee25 Aug 13, 2020
cd6c397
readme file changes
eclee25 Aug 17, 2020
50dd924
change to latest docker image
eclee25 Aug 17, 2020
99b9ba7
dev image
eclee25 Aug 17, 2020
db9ddfd
make sensible load_config err + test
eclee25 Aug 17, 2020
3a10fb3
Updated docker file
jkamins7 Aug 25, 2020
989dfaa
Merge pull request #367 from HopkinsIDD/dockerfile_fix
jkamins7 Aug 25, 2020
28f5462
Merge branch 'master' into dev
jkamins7 Sep 3, 2020
7a0f477
Removed failing workflow
jkamins7 Sep 3, 2020
641b7c4
Merge branch 'dev' into dockerfile_fix
jkamins7 Sep 3, 2020
a8d30a8
Merge pull request #369 from HopkinsIDD/dockerfile_fix
jkamins7 Sep 3, 2020
146473d
Removed more rstudio config from docker file
jkamins7 Sep 3, 2020
9fe33f6
Removed more rstudio config from docker file
jkamins7 Sep 3, 2020
05c2b42
Merge pull request #371 from HopkinsIDD/dockerfile_fix
jkamins7 Sep 3, 2020
ee93fd7
Removed outdated vignettes
jkamins7 Sep 3, 2020
5b6bfe9
Merge branch 'dev' of github.com:HopkinsIDD/COVIDScenarioPipeline int…
jkamins7 Sep 3, 2020
45812a4
Updated covidImportation version in docker
jkamins7 Sep 9, 2020
4471d8f
Updated packrat
jkamins7 Sep 9, 2020
242d3d0
Updated docker to include egg package
jkamins7 Sep 18, 2020
57e8ea7
Added cdltools to docker
jkamins7 Oct 2, 2020
42078d4
Hopefully this works
jkamins7 Oct 20, 2020
31fd2f7
Merge pull request #377 from HopkinsIDD/dev_packages
jkamins7 Oct 20, 2020
30140c6
Updated action
jkamins7 Oct 20, 2020
c3fce04
Merge pull request #378 from HopkinsIDD/dockerhub_update
jkamins7 Oct 20, 2020
5b5e0db
Updated dockerfile to test workflow
jkamins7 Oct 21, 2020
28353ef
Merge branch 'dev' into dockerhub_update
jkamins7 Oct 21, 2020
115ce31
Merge pull request #379 from HopkinsIDD/dockerhub_update
jkamins7 Oct 21, 2020
22a0f88
A
jkamins7 Oct 21, 2020
2e692dc
Merge branch 'dev' into dockerhub_update
jkamins7 Oct 21, 2020
32e7f88
Merge pull request #380 from HopkinsIDD/dockerhub_update
jkamins7 Oct 21, 2020
813cf72
Another docker test
jkamins7 Oct 21, 2020
e6bb49d
Merge branch 'dev' into dockerhub_update
jkamins7 Oct 21, 2020
f9ead8e
Merge pull request #382 from HopkinsIDD/dockerhub_update
jkamins7 Oct 21, 2020
fe37f58
Another docker test
jkamins7 Oct 21, 2020
0d9a5da
Merge branch 'dockerhub_update' of github.com:HopkinsIDD/COVIDScenari…
jkamins7 Oct 21, 2020
3fbf15e
Merge branch 'dev' into dockerhub_update
jkamins7 Oct 21, 2020
50a710f
Merge pull request #383 from HopkinsIDD/dockerhub_update
jkamins7 Oct 21, 2020
2dcd1e3
Need lib for globaltoolboxlite for some reason
jkamins7 Oct 21, 2020
9aa3c49
Merge branch 'dev' into dockerhub_update
jkamins7 Oct 21, 2020
2123dd1
Merge pull request #384 from HopkinsIDD/dockerhub_update
jkamins7 Oct 21, 2020
f7f84f8
Added src for packages that were missing it
jkamins7 Oct 21, 2020
e9372a7
Merge branch 'dockerhub_update' of github.com:HopkinsIDD/COVIDScenari…
jkamins7 Oct 21, 2020
8d35590
Merge branch 'dev' into dockerhub_update
jkamins7 Oct 21, 2020
d540d8a
Merge pull request #385 from HopkinsIDD/dockerhub_update
jkamins7 Oct 21, 2020
4cf0227
Adding covidImportation lib
jkamins7 Oct 21, 2020
844ed43
Merge branch 'dockerhub_update' of github.com:HopkinsIDD/COVIDScenari…
jkamins7 Oct 21, 2020
a346231
Merge branch 'dev' into dockerhub_update
jkamins7 Oct 21, 2020
c9b96d9
Merge pull request #386 from HopkinsIDD/dockerhub_update
jkamins7 Oct 21, 2020
9fa148b
Update dockerhub.yaml
jkamins7 Oct 22, 2020
fbde27c
Updating dockerhub workflow to trigger when it is modified
jkamins7 Oct 22, 2020
cb219ec
Merge branch 'dev' of github.com:HopkinsIDD/COVIDScenarioPipeline int…
jkamins7 Oct 22, 2020
7a76208
Updated build to include some more things
jkamins7 Oct 22, 2020
cae0835
Updated to new covidImportation version
jkamins7 Oct 23, 2020
aeaa593
Updated packrat for lwgeom and sf to support newest covidImportation
jkamins7 Oct 23, 2020
ec82fa4
Re-adding aws apl workflow to build aws images for apl
jkamins7 Oct 28, 2020
1a16979
Updated yaml files to trigger when they are modified
jkamins7 Oct 28, 2020
15a616c
wrote yml instead of yaml
jkamins7 Oct 28, 2020
5c27fba
Updated packrat for shaun
jkamins7 Mar 4, 2022
0703e38
Merge pull request #457 from HopkinsIDD/docker_update
jkamins7 Mar 4, 2022
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
27 changes: 21 additions & 6 deletions .github/workflows/aws-apl.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# This workflow will build and push a new container image to Amazon ECR The following information will need to be included in your Github secrets: - AWS_ACCESS_KEY_ID: dedicated
# user AWS key ID - AWS_SECRET_ACCESS_KEY: dedicated user AWS access key - AWS_REGION: your AWS region, ex: us-east-1, us-west-2... - ECR_REPOSITORY_NAME: name of the ECR
# repository, ex: myrepo
# This workflow will build and push a new container image to Amazon ECR
# The following information will need to be included in your Github secrets:
# - AWS_ACCESS_KEY_ID_APL: dedicated user AWS key ID
# - AWS_SECRET_ACCESS_KEY_APL: dedicated user AWS access key
# - AWS_REGION_APL: your AWS region, ex: us-east-1, us-west-2...
# - ECR_REPOSITORY_NAME_APL: name of the ECR repository, ex: myrepo
on:
push:
branches:
Expand All @@ -9,10 +12,16 @@ on:
- dataseed
paths:
- 'requirements.txt'
- 'packages.R'
- 'local_install.R'
- 'Dockerfile'
- 'R/pkgs/**' name: Deploy to Amazon ECR APL jobs:
- 'R/pkgs/**'
- '.Rprofile'
- 'packrat/**'
- '.github/workflows/aws-apl.yaml'

name: Deploy to Amazon ECR APL

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
Expand All @@ -37,11 +46,15 @@ on:
IMAGE_TAG_RUN: ${{ github.run_number }}
IMAGE_TAG_REF: ${{ github.ref }}
run: |
# Build a docker container and push it to ECR so that it can be deployed to ECS.
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG_SHA .

# Add new tags
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG_SHA $ECR_REGISTRY/$ECR_REPOSITORY:$(git log -1 --pretty=%h)
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG_SHA $ECR_REGISTRY/$ECR_REPOSITORY:${IMAGE_TAG_REF##*/}-r$IMAGE_TAG_RUN

if [[ $IMAGE_TAG_REF == *master* ]]; then
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG_SHA $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG_SHA $ECR_REGISTRY/$ECR_REPOSITORY:latest-master
Expand All @@ -53,8 +66,10 @@ on:
echo "Error, branch not recognized"
exit 1
fi

docker push $ECR_REGISTRY/$ECR_REPOSITORY
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY"

- name: Logout of Amazon ECR
if: always()
run: docker logout ${{ steps.login-ecr.outputs.registry }}
1 change: 1 addition & 0 deletions .github/workflows/aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
- 'R/pkgs/**'
- '.Rprofile'
- 'packrat/**'
- '.github/workflows/aws.yaml'

name: Deploy to Amazon ECR

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ jobs:
setwd("R/pkgs/hospitalization")
devtools::test(stop_on_failure=TRUE)
shell: Rscript {0}
- name: Run report_generation tests
- name: Run report.generation tests
run: |
setwd("R/pkgs/report_generation")
setwd("R/pkgs/report.generation")
devtools::test(stop_on_failure=TRUE)
shell: Rscript {0}
- name: Run integration tests
Expand Down
49 changes: 29 additions & 20 deletions .github/workflows/dockerhub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
- 'R/pkgs/**'
- '.Rprofile'
- 'packrat/**'
- '.github/workflows/dockerhub*'

name: Deploy to DockerHub

Expand All @@ -29,6 +30,19 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
Username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Generate Tags
id: tags
env:
Expand All @@ -39,29 +53,24 @@ jobs:
echo "::set-output name=reftag::${IMAGE_TAG_REF##*/}-r$IMAGE_TAG_RUN"

- name: Build Push Master
uses: docker/build-push-action@v1
uses: docker/build-push-action@v2
if: contains( github.ref, 'master') || contains( github.base_ref, 'master' )
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: hopkinsidd/covidscenariopipeline
tags: latest,latest-master,${{steps.tags.outputs.shashort}},${{steps.tags.outputs.reftag}},${{ github.sha }}
push: true
tags: |
hopkinsidd/covidscenariopipeline:latest
hopkinsidd/covidscenariopipeline:latest-master
hopkinsidd/covidscenariopipeline:${{steps.tags.outputs.shashort}}
hopkinsidd/covidscenariopipeline:${{steps.tags.outputs.reftag}}
hopkinsidd/covidscenariopipeline:${{ github.sha }}

- name: Build Push Dev
uses: docker/build-push-action@v1
uses: docker/build-push-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: hopkinsidd/covidscenariopipeline
tags: latest-dev,${{steps.tags.outputs.shashort}},${{steps.tags.outputs.reftag}},${{ github.sha }}
push: true
tags: |
hopkinsidd/covidscenariopipeline:latest-dev
hopkinsidd/covidscenariopipeline:${{steps.tags.outputs.shashort}}
hopkinsidd/covidscenariopipeline:${{steps.tags.outputs.reftag}}
hopkinsidd/covidscenariopipeline:${{ github.sha }}
if: contains( github.ref , 'dev') || contains( github.base_ref, 'dev' )


- name: Build Push Dataseed
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: hopkinsidd/covidscenariopipeline
tags: latest-dataseed,${{steps.tags.outputs.shashort}},${{steps.tags.outputs.reftag}},${{ github.sha }}
if: contains( github.ref , 'dataseed') || contains( github.base_ref, 'dataseed' )
22 changes: 2 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ ENV LC_ALL en_US.UTF-8
# set noninteractive installation
ENV DEBIAN_FRONTEND noninteractive
ENV R_VERSION 3.6.3-1bionic
ENV RSTUDIO_VERSION 1.2.5033

# see https://www.digitalocean.com/community/tutorials/how-to-install-r-on-ubuntu-18-04
# https://cran.r-project.org/bin/linux/debian/
Expand Down Expand Up @@ -70,7 +69,6 @@ RUN apt-get update && \
supervisor \
awscli \
r-base-dev=$R_VERSION \
openjdk-8-jdk \
# make sure we have up-to-date CA certs or curling some https endpoints (like python.org) may fail
ca-certificates \
# app user creation
Expand All @@ -96,14 +94,9 @@ RUN Rscript -e "install.packages('packrat',repos='https://cloud.r-project.org/')
COPY --chown=app:app packrat $HOME/packrat
COPY --chown=app:app Docker.Rprofile $HOME/.Rprofile
COPY --chown=app:app R/pkgs $HOME/R/pkgs
RUN Rscript -e 'packrat::restore()' \
&& curl -O https://download2.rstudio.org/server/bionic/amd64/rstudio-server-$RSTUDIO_VERSION-amd64.deb \
&& sudo apt-get install -f -y ./rstudio-server-$RSTUDIO_VERSION-amd64.deb \
&& rm -f ./rstudio-server-$RSTUDIO_VERSION-amd64.deb
RUN Rscript -e 'install.packages(list.files("R/pkgs",full.names=TRUE),type="source",repos=NULL)' \
RUN Rscript -e 'packrat::restore()'
RUN Rscript -e 'install.packages(list.files("R/pkgs",full.names=TRUE,recursive=TRUE),type="source",repos=NULL)'

# expose Rstudio port
EXPOSE 8787

#####
# Python (managed via pyenv)
Expand Down Expand Up @@ -134,15 +127,4 @@ RUN . $PYTHON_VENV_DIR/bin/activate \
&& pip install --upgrade pip setuptools \
&& pip install -r $HOME/requirements.txt


#####
# Spark
#####

ENV SPARK_VERSION 2.4.5

RUN cd /opt \
&& curl -L http://mirrors.ocf.berkeley.edu/apache/spark/spark-$SPARK_VERSION/spark-$SPARK_VERSION-bin-hadoop2.7.tgz | sudo tar xvfz - \
&& sudo ln -s spark-$SPARK_VERSION-bin-hadoop2.7 spark

CMD ["/bin/bash"]
11 changes: 9 additions & 2 deletions R/pkgs/covidcommon/R/config.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@ load_config <- function(fname) {
fname <- Sys.getenv("CONFIG_PATH")
}
if (!missing(fname)) {
handlers <- list(map=function(x) { class(x) <- "config"; return(x) })
return(tryCatch(yaml.load_file(fname, handlers=handlers), error = function(e) { stop(paste("Could not find file: ", fname)) }))

if(!file.exists(fname)){
stop(paste("Could not find file:", fname))
} else{
handlers <- list(map=function(x) { class(x) <- "config"; return(x) })
return(tryCatch(yaml.load_file(fname, handlers=handlers), error = function(e) { stop(paste("The config", fname, "has an error. Run `yaml::read_yaml(", fname, ")` to identify the line where the error exists.")) }))
}


} else {
return(NA)
}
Expand Down
9 changes: 8 additions & 1 deletion R/pkgs/covidcommon/tests/testthat/test-load_config.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
test_that("load_config works", {
fname <- tempfile()
cat("yaml: TRUE\n",file=fname)
fname_bad <- tempfile()
cat("yaml: TRUE\n yaml2: FALSE\n",file=fname_bad)

expect_equal(
load_config(fname)$yaml,
Expand All @@ -9,7 +11,7 @@ test_that("load_config works", {

expect_error(
load_config(";lkdjaoijdsfjoasidjfaoiwerfj q2fu8ja8erfasdiofj aewr;fj aff409a urfa8rf a';j 38i a0fuadf "),
"file"
"Could not find"
)

expect_error(
Expand All @@ -21,6 +23,11 @@ test_that("load_config works", {
load_config(fname)$missing$badkey,
"missing"
)

expect_error(
load_config(fname_bad),
"yaml::read_yaml"
)
})

test_that("as_evaled_expression works", {
Expand Down
1 change: 1 addition & 0 deletions R/pkgs/hospitalization/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ Description: Generate hospitalization scenarios corresponding to the infection s
License: What license it uses
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.0
7 changes: 4 additions & 3 deletions R/pkgs/hospitalization/NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Generated by roxygen2: fake comment so roxygen2 overwrites silently.
exportPattern("^[^\\.]")
# Generated by roxygen2: do not edit by hand

importFrom(foreach,"%dopar%")
export(build_hospdeath_geoid_fixedIFR_par)
export(build_hospdeath_par)
export(create_delay_frame)
15 changes: 12 additions & 3 deletions R/pkgs/hospitalization/R/hospdeath.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ create_delay_frame <- function(data, name, local_config){
geoid %in% all_geoids
) %>%
dplyr::arrange(geoid,time) %>%
ungroup()
dplyr::ungroup()

data <- dplyr::arrange(data,geoid,time)

Expand All @@ -120,6 +120,9 @@ create_delay_frame <- function(data, name, local_config){
return(data)
}




hosp_create_delay_frame <- function(X, p_X, data_, X_pars, varname) {
X_ <- rbinom(length(data_[[X]]),data_[[X]],p_X)
rc <- data.table::data.table(
Expand Down Expand Up @@ -388,6 +391,11 @@ build_hospdeath_geoid_fixedIFR_par <- function(
left_join(prob_dat, by="geoid")

# Add time things
dat_Mild <- hosp_create_delay_frame('incidI',
dat_$p_mild_inf,
dat_,
c(-Inf, 0), # we dont want a delay here, so this is the easiest way
"Mild")
dat_H <- hosp_create_delay_frame('incidI',
dat_$p_hosp_inf_scaled,
dat_,
Expand All @@ -408,13 +416,14 @@ build_hospdeath_geoid_fixedIFR_par <- function(
ICU_dur_ <- round(exp(time_ICUdur_pars[1]))
Vent_dur_ <- round(exp(time_ventdur_pars[1]))

stopifnot(is.data.table(dat_I) && is.data.table(dat_H) && is.data.table(data_ICU) && is.data.table(data_Vent) && is.data.table(data_D))
stopifnot(is.data.table(dat_I) && is.data.table(dat_Mild) && is.data.table(dat_H) && is.data.table(data_ICU) && is.data.table(data_Vent) && is.data.table(data_D))

# Using `merge` instead of full_join for performance reasons
res <- Reduce(function(x, y, ...) merge(x, y, all = TRUE, ...),
list(dat_I, dat_H, data_ICU, data_Vent, data_D)) %>%
list(dat_I, dat_Mild, dat_H, data_ICU, data_Vent, data_D)) %>%
replace_na(
list(incidI = 0,
incidMild = 0,
incidH = 0,
incidICU = 0,
incidVent = 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export(make_scn_time_summary_table)
export(make_scn_time_summary_table_withVent)
export(plot_event_time_by_geoid)
export(plot_geounit_attack_rate_map)
export(plot_geounit_map)
export(plot_hist_incidHosp_state)
export(plot_line_hospPeak_time_county)
export(plot_model_vs_obs)
Expand All @@ -35,4 +36,3 @@ export(plot_ts_incid_inf_state_sample)
export(print_pretty_date)
export(print_pretty_date_short)
export(reference_chunk)
export(setup_testing_environment)
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ load_scenario_sims_filtered <- function(scenario_dir,
##' with pre and post filters
##'
##' @param scenario_dir the subdirectory containing this scenario
##' @param name_filter function that
##' @param name_filter string that indicates which pdeath level to import (from the hosp filename)
##' @param post_process function that does processing after
##' @param geoid_len in defined, this we want to make geoids all the same length
##' @param padding_char character to add to the front of geoids if fixed length
Expand Down Expand Up @@ -172,8 +172,8 @@ load_hosp_sims_filtered <- function(scenario_dir,

read_file(files[i]) %>%
padfn %>%
post_process(...) %>%
mutate(sim_num = i)
mutate(sim_num = i) %>%
post_process(...)
}

rc<- dplyr::bind_rows(rc)
Expand Down
Loading