Skip to content

Commit

Permalink
Format the time point output differently
Browse files Browse the repository at this point in the history
  • Loading branch information
r-ash committed Dec 10, 2024
1 parent 53ceefc commit c4fb548
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions R/pepfar-datapack.R
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,19 @@ build_datapack_output <- function(naomi_output, psnu_level, dmppt2_output) {
}

build_datapack_metadata <- function(naomi_output, ids) {
meta_period <- get_period_metadata(
c(naomi_output$fit$model_options$calendar_quarter_t1,
naomi_output$fit$model_options$calendar_quarter_t2,
naomi_output$fit$model_options$calendar_quarter_t3,
naomi_output$fit$model_options$calendar_quarter_t4,
naomi_output$fit$model_options$calendar_quarter_t5))
cqs <- c(naomi_output$fit$model_options$calendar_quarter_t1,
naomi_output$fit$model_options$calendar_quarter_t2,
naomi_output$fit$model_options$calendar_quarter_t3,
naomi_output$fit$model_options$calendar_quarter_t4,
naomi_output$fit$model_options$calendar_quarter_t5)
meta_period <- data.frame(
c("Time point", "t1", "t2", "t3", "t4", "t5"), c("Quarter", cqs)
)

info <- attr(naomi_output, "info")
inputs <- read.csv(text = info$inputs.csv, header = FALSE)

version <- data.frame("version", utils::packageVersion("naomi"))
version <- data.frame("Version", utils::packageVersion("naomi"))

if (!is.null(ids)) {
all_data <- list(version, ids, inputs, meta_period)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-downloads.R
Original file line number Diff line number Diff line change
Expand Up @@ -349,5 +349,5 @@ test_that("datapack download can include vmmc data", {
metadata <- readxl::read_xlsx(out$path, "metadata")

expect_true(nrow(metadata) > 0)
expect_equal(as.character(metadata[1, 1]), "version")
expect_equal(as.character(metadata[1, 1]), "Version")
})

0 comments on commit c4fb548

Please sign in to comment.