Skip to content

Commit

Permalink
jidea-130 Replace Community Infections time series with Prevalence (#22)
Browse files Browse the repository at this point in the history
* replace infect with prevalence

* lint
  • Loading branch information
EmmaLRussell authored Oct 9, 2024
1 parent 801bbab commit be45781
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
8 changes: 6 additions & 2 deletions R/model_run.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ model_run <- function(parameters, model_version) {
time_series,
id_cols = "time", values_from = "value", names_from = "compartment"
)
time_series$infect <- time_series$infect_asymp + time_series$infect_symp
time_series <- time_series[, c("infect",
time_series$prevalence <-
time_series$infect_asymp +
time_series$infect_symp +
time_series$hospitalised

time_series <- time_series[, c("prevalence",
"hospitalised",
"dead")]

Expand Down
5 changes: 4 additions & 1 deletion inst/json/metadata_0.1.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@
}
],
"time_series": [
{ "id": "infect", "label": "Community infections", "description": "Infections not requiring hospitalisation" },
{
"id": "prevalence",
"label": "Prevalence",
"description": "Number of infectious individuals, comprising both symptomatic and asymptomatic infections, including those in need of hospitalisation." },
{ "id": "hospitalised", "label": "Hospital demand", "description": "Infections requiring hospitalisation" },
{ "id": "dead", "label": "Dead", "description": "Cumulative deaths" }
]
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_model_run.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ test_that("can run model and return results", {
"interventions",
"capacities"
))
expect_named(res$time_series, c("infect",
expect_named(res$time_series, c("prevalence",
"hospitalised",
"dead"))
expect_identical(res$time_series$infect, c(16L, 56L))
expect_identical(res$time_series$prevalence, c(27L, 87L))
expect_identical(res$time_series$hospitalised, c(11L, 31L))
expect_identical(res$time_series$dead, c(15L, 35L))
expect_identical(res$parameters, parameters)
Expand Down

0 comments on commit be45781

Please sign in to comment.