Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.4.0 #83

Merged
merged 4 commits into from
Nov 25, 2024
Merged
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: hubAdmin
Title: Utilities for Administering Hubverse Hubs
Version: 1.3.0.9000
Version: 1.4.0
Authors@R: c(
person("Anna", "Krystalli", , "annakrystalli@googlemail.com", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-2378-4915")),
@@ -26,7 +26,7 @@ Imports:
fs,
glue,
gt (>= 0.11.1),
hubUtils (>= 0.1.7.9000),
hubUtils (>= 0.3.0),
jsonlite,
jsonvalidate,
magrittr,
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# hubAdmin (development version)
# hubAdmin 1.4.0

* Support v4.0.0 schema configuration of output types and output type IDs when creating config files programmatically. Specifically, whether an output type is required or not is specified via the `is_required` logical property whereas the `output_type_id` values as provided through the `required` property only (#53). In addition, `output_type_id` `required` value is now encoded as `NULL` instead of `NA` (#72).
* Programmatically created higher level config elements now have a `branch` attribute that can be used to create and validate objects against a schema which is still in development and has not been released to the `main` branch yet.
2 changes: 1 addition & 1 deletion R/append_round.R
Original file line number Diff line number Diff line change
@@ -118,7 +118,7 @@
#' append_round(config, new_round)
#' # Append in existing config file
#' config <- hubUtils::read_config_file(
#' system.file("tasks.json", package = "hubAdmin")
#' system.file("v4-tasks.json", package = "hubAdmin")
#' )
#' append_round(config, new_round)
append_round <- function(config, ...) {
6 changes: 3 additions & 3 deletions R/create_model_tasks.R
Original file line number Diff line number Diff line change
@@ -83,11 +83,11 @@
#' value_type = "double"
#' ),
#' create_output_type_quantile(
#' required = c(0.25, 0.5, 0.75),
#' optional = c(
#' required = c(
#' 0.1, 0.2, 0.3, 0.4, 0.6,
#' 0.7, 0.8, 0.9
#' ),
#' is_required = TRUE,
#' value_type = "double",
#' value_minimum = 0
#' )
@@ -145,7 +145,7 @@
#' "increase",
#' "large_increase"
#' ),
#' optional = NULL,
#' is_required = TRUE,
#' value_type = "double"
#' )
#' ),
4 changes: 2 additions & 2 deletions R/create_output_type.R
Original file line number Diff line number Diff line change
@@ -23,11 +23,11 @@
#' value_type = "double"
#' ),
#' create_output_type_quantile(
#' required = c(0.25, 0.5, 0.75),
#' optional = c(
#' required = c(
#' 0.1, 0.2, 0.3, 0.4, 0.6,
#' 0.7, 0.8, 0.9
#' ),
#' is_required = TRUE,
#' value_type = "double",
#' value_minimum = 0
#' )
55 changes: 55 additions & 0 deletions inst/v4-tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"schema_version": "https://raw.githubusercontent.com/hubverse-org/schemas/main/v4.0.0/tasks-schema.json",
"rounds": [
{
"round_id_from_variable": true,
"round_id": "origin_date",
"model_tasks": [
{
"task_ids": {
"origin_date": {
"required": null,
"optional": ["2023-01-02", "2023-01-09", "2023-01-16"]
},
"location": {
"required": ["US"],
"optional": ["01", "02", "04", "05", "06"]
},
"horizon": {
"required": [1],
"optional": [2, 3, 4]
}
},
"output_type": {
"mean": {
"output_type_id": {
"required": null
},
"is_required": true,
"value": {
"type": "double",
"minimum": 0
}
}
},
"target_metadata": [
{
"target_id": "inc hosp",
"target_name": "Weekly incident influenza hospitalizations",
"target_units": "rate per 100,000 population",
"target_keys": null,
"target_type": "discrete",
"is_step_ahead": true,
"time_unit": "week"
}
]
}
],
"submissions_due": {
"relative_to": "origin_date",
"start": -4,
"end": 2
}
}
]
}
2 changes: 1 addition & 1 deletion man/append_round.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/create_model_tasks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/create_output_type.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions tests/testthat/_snaps/create_config.md
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
create_config(rounds)
Output
$schema_version
[1] "https://raw.githubusercontent.com/hubverse-org/schemas/main/v3.0.1/tasks-schema.json"
[1] "https://raw.githubusercontent.com/hubverse-org/schemas/main/v4.0.0/tasks-schema.json"

$rounds
$rounds[[1]]
@@ -46,12 +46,12 @@
$rounds[[1]]$model_tasks[[1]]$output_type$mean
$rounds[[1]]$model_tasks[[1]]$output_type$mean$output_type_id
$rounds[[1]]$model_tasks[[1]]$output_type$mean$output_type_id$required
[1] NA

$rounds[[1]]$model_tasks[[1]]$output_type$mean$output_type_id$optional
NULL


$rounds[[1]]$model_tasks[[1]]$output_type$mean$is_required
[1] TRUE

$rounds[[1]]$model_tasks[[1]]$output_type$mean$value
$rounds[[1]]$model_tasks[[1]]$output_type$mean$value$type
[1] "double"
@@ -107,7 +107,7 @@
attr(,"type")
[1] "tasks"
attr(,"schema_id")
[1] "https://raw.githubusercontent.com/hubverse-org/schemas/main/v3.0.1/tasks-schema.json"
[1] "https://raw.githubusercontent.com/hubverse-org/schemas/main/v4.0.0/tasks-schema.json"
attr(,"branch")
[1] "main"

48 changes: 24 additions & 24 deletions tests/testthat/_snaps/create_model_task.md
Original file line number Diff line number Diff line change
@@ -41,12 +41,12 @@
$output_type$mean
$output_type$mean$output_type_id
$output_type$mean$output_type_id$required
[1] NA

$output_type$mean$output_type_id$optional
NULL


$output_type$mean$is_required
[1] TRUE

$output_type$mean$value
$output_type$mean$value$type
[1] "double"
@@ -85,7 +85,7 @@
attr(,"class")
[1] "model_task" "list"
attr(,"schema_id")
[1] "https://raw.githubusercontent.com/hubverse-org/schemas/main/v3.0.1/tasks-schema.json"
[1] "https://raw.githubusercontent.com/hubverse-org/schemas/main/v4.0.0/tasks-schema.json"
attr(,"branch")
[1] "main"

@@ -136,12 +136,12 @@
$output_type$mean
$output_type$mean$output_type_id
$output_type$mean$output_type_id$required
[1] NA

$output_type$mean$output_type_id$optional
NULL


$output_type$mean$is_required
[1] TRUE

$output_type$mean$value
$output_type$mean$value$type
[1] "double"
@@ -153,9 +153,6 @@

$output_type$sample
$output_type$sample$output_type_id_params
$output_type$sample$output_type_id_params$is_required
[1] FALSE

$output_type$sample$output_type_id_params$type
[1] "character"

@@ -172,6 +169,9 @@
[1] "horizon" "origin_date"


$output_type$sample$is_required
[1] FALSE

$output_type$sample$value
$output_type$sample$value$type
[1] "double"
@@ -213,7 +213,7 @@
attr(,"class")
[1] "model_task" "list"
attr(,"schema_id")
[1] "https://raw.githubusercontent.com/hubverse-org/schemas/main/v3.0.1/tasks-schema.json"
[1] "https://raw.githubusercontent.com/hubverse-org/schemas/main/v4.0.0/tasks-schema.json"
attr(,"branch")
[1] "main"

@@ -228,8 +228,8 @@
output_type = create_output_type(create_output_type_mean(is_required = TRUE,
value_type = "double", value_minimum = 0L), create_output_type_median(
is_required = FALSE, value_type = "double"), create_output_type_quantile(
required = c(0.25, 0.5, 0.75), optional = c(0.1, 0.2, 0.3, 0.4, 0.6, 0.7, 0.8,
0.9), value_type = "double", value_minimum = 0)), target_metadata = create_target_metadata(
required = c(0.1, 0.2, 0.3, 0.4, 0.6, 0.7, 0.8, 0.9), is_required = TRUE,
value_type = "double", value_minimum = 0)), target_metadata = create_target_metadata(
create_target_metadata_item(target_id = "inc hosp", target_name = "Weekly incident influenza hospitalizations",
target_units = "rate per 100,000 population", target_keys = list(target = "inc hosp"),
target_type = "discrete", is_step_ahead = TRUE, time_unit = "week"),
@@ -275,12 +275,12 @@
$output_type$mean
$output_type$mean$output_type_id
$output_type$mean$output_type_id$required
[1] NA

$output_type$mean$output_type_id$optional
NULL


$output_type$mean$is_required
[1] TRUE

$output_type$mean$value
$output_type$mean$value$type
[1] "double"
@@ -295,9 +295,9 @@
$output_type$median$output_type_id$required
NULL

$output_type$median$output_type_id$optional
[1] NA

$output_type$median$is_required
[1] FALSE

$output_type$median$value
$output_type$median$value$type
@@ -308,12 +308,12 @@
$output_type$quantile
$output_type$quantile$output_type_id
$output_type$quantile$output_type_id$required
[1] 0.25 0.50 0.75

$output_type$quantile$output_type_id$optional
[1] 0.1 0.2 0.3 0.4 0.6 0.7 0.8 0.9


$output_type$quantile$is_required
[1] TRUE

$output_type$quantile$value
$output_type$quantile$value$type
[1] "double"
@@ -379,7 +379,7 @@
attr(,"class")
[1] "model_task" "list"
attr(,"schema_id")
[1] "https://raw.githubusercontent.com/hubverse-org/schemas/main/v3.0.1/tasks-schema.json"
[1] "https://raw.githubusercontent.com/hubverse-org/schemas/main/v4.0.0/tasks-schema.json"
attr(,"branch")
[1] "main"

@@ -440,8 +440,8 @@
x `schema_id` attributes are not consistent across all arguments.
Argument `schema_id` attributes:
* task_ids : invalid_schema_id
* output_type : https://raw.githubusercontent.com/hubverse-org/schemas/main/v3.0.1/tasks-schema.json
* target_metadata : https://raw.githubusercontent.com/hubverse-org/schemas/main/v3.0.1/tasks-schema.json
* output_type : https://raw.githubusercontent.com/hubverse-org/schemas/main/v4.0.0/tasks-schema.json
* target_metadata : https://raw.githubusercontent.com/hubverse-org/schemas/main/v4.0.0/tasks-schema.json

---

Loading