Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b71e2d7
start of reading either API
natemcintosh Jun 17, 2025
091b21c
add news entry
natemcintosh Jun 17, 2025
f815018
start of new tests
natemcintosh Jun 17, 2025
7b593d1
add new api test file
natemcintosh Jun 17, 2025
1df7505
needed to make sure every reference date existed
natemcintosh Jun 23, 2025
19648a3
Merge branch 'main' into nam-api-v2-prep
micahwiesner67 Jun 24, 2025
9c49ad7
Merge branch 'main' into nam-api-v2-prep
natemcintosh Jun 25, 2025
de138bf
first working version of reader for api v2
natemcintosh Jun 30, 2025
36c3359
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 30, 2025
4e27878
set up proportion active argument.
natemcintosh Jun 30, 2025
ebc05ce
Air formatter
natemcintosh Jun 30, 2025
d1f8397
fix test issues
natemcintosh Jun 30, 2025
0b4da22
attempting fixes suggested on the internet
natemcintosh Jun 30, 2025
645c69b
love messing up my less than, equal, greater than
natemcintosh Jun 30, 2025
114462b
changes to allow use of the new field
natemcintosh Jul 1, 2025
e7a1b20
Merge branch 'main' into nam-api-v2-prep
natemcintosh Jul 1, 2025
ae1ce90
Merge branch 'main' into nam-api-v2-prep
natemcintosh Jul 15, 2025
487be6d
forgot to add facility active field to metadata
natemcintosh Jul 31, 2025
39dab0f
Merge branch 'main' into dev-nam_api_v2_prep
micahwiesner67 Feb 24, 2026
69848a4
roxygenize + tagging cmdstanr release version
micahwiesner67 Feb 24, 2026
c36abb6
removing rogue comma in list
micahwiesner67 Feb 24, 2026
16aaa81
adding facility active proportion to test json
micahwiesner67 Feb 24, 2026
40b4337
removing big exclusions test as this test parquet does not exist
micahwiesner67 Feb 24, 2026
28e023b
Update R/config.R
micahwiesner67 Feb 25, 2026
8e65f28
exposing API input container and DATA_API argument for simplicity tog…
micahwiesner67 Feb 25, 2026
e8964c6
adding input data api container to make test target
micahwiesner67 Feb 25, 2026
7205430
Merge branch 'main' into dev-nam_api_v2_prep
micahwiesner67 Mar 20, 2026
d2e91b5
Update NEWS.md
micahwiesner67 Mar 20, 2026
3b08ced
Update R/config.R
micahwiesner67 Apr 3, 2026
f43c2ac
adding logging to read_data to explicitly state API used
micahwiesner67 Apr 3, 2026
f4c9e34
Apply suggestions from code review
micahwiesner67 Apr 3, 2026
c2ff8d1
checking value for numeric
micahwiesner67 Apr 3, 2026
b314fa6
configuring with air
micahwiesner67 Apr 3, 2026
bde607a
updating roxygen documentation
micahwiesner67 Apr 3, 2026
4a1dcd1
pre commit and updating glue in DESCRIPTION file
micahwiesner67 Apr 3, 2026
4548b90
updating roxygen
micahwiesner67 Apr 3, 2026
39f7fee
adding readme to tests/testthat/data
micahwiesner67 Apr 6, 2026
9b4f0c4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 6, 2026
8822240
updating documentation in config
micahwiesner67 Apr 7, 2026
bbb45b9
Apply suggestions from code review
micahwiesner67 Apr 7, 2026
3e3a143
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 7, 2026
4466890
updating documentation in read_data function
micahwiesner67 Apr 7, 2026
088557c
adding tests for facility active proportion
micahwiesner67 Apr 8, 2026
ebc6a65
roxygenizeing
micahwiesner67 Apr 8, 2026
fa93197
making DATA lowercase
micahwiesner67 Apr 8, 2026
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
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ License: Apache License (>= 2)
Encoding: UTF-8
Remotes:
github::epiforecasts/EpiNow2@9b8cd4fcceca41ac34545a38989f6f295ddeeaf7,
github::stan-dev/cmdstanr
github::stan-dev/cmdstanr@da99e2ba954658bdad63bffb738c4444c33a4e0e
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
Suggests:
Expand Down Expand Up @@ -51,7 +51,9 @@ Imports:
tidyr,
tidybayes,
optparse,
Microsoft365R
Microsoft365R,
stringr,
glue
Additional_repositories:
https://stan-dev.r-universe.dev
URL: https://cdcgov.github.io/cfa-epinow2-pipeline/
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@ IMAGE_NAME=cfa-epinow2-pipeline
BRANCH=$(shell git branch --show-current)
CONFIG_CONTAINER=rt-epinow2-config
CNTR_MGR=docker
DATA_API=v1
ifeq ($(BRANCH), main)
TAG=latest
else
TAG=$(BRANCH)
endif

ifeq ($(DATA_API),v1)
API_CONTAINER := nssp-etl
else ifeq ($(DATA_API),v2)
API_CONTAINER := nssp-etl-api-v2
else
$(error Unknown DATA_API '$(DATA_API)'. Expected v1 or v2)
endif

CONFIG=test.json
POOL="cfa-epinow2-$(TAG)"
TIMESTAMP:=$(shell date -u +"%Y%m%d_%H%M%S")
Expand Down Expand Up @@ -38,12 +47,14 @@ config: ## Generates a configuration file for running the model
--disease="COVID-19,Influenza,RSV" \
--state=all \
--output-container=nssp-rt-v2 \
--input-container=$(API_CONTAINER) \
--job-id=$(JOB) \
--report-date-str=$(REPORT_DATE)

rerun-config: ## Generate a configuration file to rerun a previous model
uv run azure/generate_rerun_configs.py \
--output-container=nssp-rt-v2 \
--input-container=$(API_CONTAINER) \
--job-id=$(JOB) \
--report-date-str=$(REPORT_DATE)

Expand Down Expand Up @@ -84,6 +95,7 @@ test-batch: ## Run GitHub Actions workflow and then job.py for testing on Azure
--disease="COVID-19,Influenza,RSV" \
--state=NY \
--output-container=nssp-rt-testing \
--input-container=$(API_CONTAINER) \
--job-id=$(JOB) \
--report-date-str=$(REPORT_DATE)
uv run --env-file .env \
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# CFAEpiNow2Pipeline v0.2.0

## Features

* Add the ability to read data from API v2 as well as v1
* dependabot updating package docker/login-action from version 3 to version 4 new
* Adding image tag validation when dependabot PRs are opened and automatic update to NEWs md
* Add a utility script for reading, preparing, and uploading Rt review decisions
Expand Down
27 changes: 26 additions & 1 deletion R/config.R
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ Data <- S7::new_class(
#' "YYYY-MM-DD".
#' @param output_container An optional string specifying the output blob storage
#' container.
#' @param facility_active_proportion A numeric value between 0 and 1 specifying
#' the proportion of days during the modeling period that facilities must have
#' reported at least one informative discharge diagnosis (DDI) to be included in
#' the analysis. Default is 0.94 (require
#' active reporting for >=53 of 56 days in the training period).
#' Lower values allow inclusion of facilities with fewer active days.
#' @family config
#' @export
Config <- S7::new_class(
Expand Down Expand Up @@ -190,7 +196,26 @@ Config <- S7::new_class(
# Would add default values, but Roxygen isn't happy about them yet.
sampler_opts = S7::class_list,
exclusions = S7::S7_class(Exclusions()),
output_container = character_or_null
output_container = character_or_null,
facility_active_proportion = S7::new_property(
S7::class_double,
default = quote(0.94),
Comment thread
zsusswein marked this conversation as resolved.
validator = \(value) {
if (
rlang::is_bare_numeric(value) &&
length(value) == 1 &&
value >= 0 &&
value <= 1
) {
NULL
} else {
paste0(
"Invalid value for facility_active_proportion. ",
"It must be a single numeric value between 0 and 1."
)
}
}
)
)
)

Expand Down
13 changes: 10 additions & 3 deletions R/pipeline.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ orchestrate_pipeline <- function(
)
read_json_into_config(
config_path,
c("exclusions", "output_container")
c("exclusions", "output_container", "facility_active_proportion")
)
},
error = function(con) {
Expand All @@ -94,6 +94,7 @@ orchestrate_pipeline <- function(
}
)
if (typeof(config) == "logical") {
cli::cli_warn("Failed to read config", class = "Bad_config")
return(invisible(FALSE))
}

Expand All @@ -113,15 +114,19 @@ orchestrate_pipeline <- function(
logfile_connection <- file(file.path(logfile_path, "logs.txt"), open = "wt")
sink(
logfile_connection,
# "output" means general (non-error) output
type = "output",
append = TRUE,
# Send output to logs and to console
split = TRUE
)
sink(
logfile_connection,
# "message" means error messages
type = "message",
append = TRUE
# Unfortunately, we can't split messages to both console and log file.
# It will error out if we try
)
on.exit(sink(file = NULL))
cli::cli_alert_info("Starting run at {Sys.time()}")
Expand Down Expand Up @@ -189,7 +194,8 @@ execute_model_logic <- function(config, input_dir, output_dir) {
geo_value = config@geo_value,
report_date = config@report_date,
max_reference_date = config@max_reference_date,
min_reference_date = config@min_reference_date
min_reference_date = config@min_reference_date,
facility_active_proportion = config@facility_active_proportion
)

# rlang::is_empty() checks for empty and NULL values
Expand Down Expand Up @@ -289,7 +295,8 @@ execute_model_logic <- function(config, input_dir, output_dir) {
config@exclusions@blob_storage_container
),
# Add the config container here when refactoring out to outer func
run_at = format(Sys.time(), "%Y-%m-%dT%H:%M:%S%z")
run_at = format(Sys.time(), "%Y-%m-%dT%H:%M:%S%z"),
facility_active_proportion = config@facility_active_proportion
)

write_model_outputs(
Expand Down
Loading
Loading