cmu-delphi / cmu-delphi/epipredict

Add tests for weekly spaced data

Open
#397 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
18
Forks
13
Avg merge
21d 58m
Merged PRs (30d)
1

Description

The motivating case is this outdated snippet from `step_epi_slide`, yoinked from https://github.com/cmu-delphi/epipredict/pull/387
```
tt_week <- seq(as.Date("2022-01-01"), by = "1 week", length.out = 20)
edf_weekly <- data.frame(
time_value = c(tt_week, tt_week),
geo_value = rep(c("ca", "ny"), each = 20L),
value = c(2:21, 3:22)
) %>%
as_epi_df()

test_that("epi_slide works on weekly data with one of before/ahead set", {
expect_no_error(
baked <- epi_recipe(edf_weekly) %>%
step_epi_slide(value, .f = "mean", before = as.difftime(3, units = "weeks")) %>%
prep(edf_weekly) %>%
bake(new_data = NULL)
)
attributes(baked)$metadata$as_of <- as.Date("1999-09-09")
expect_snapshot(baked)
})
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the existing tests for step_epi_slide and the epi_recipe pipeline. Add the weekly-data case shown in the issue, covering a slide with before set and ahead unset, then run the relevant test file and update the snapshot. Done means the weekly example runs without error and its baked output is recorded.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
testing-qa
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.