Skip to content

Commit

Permalink
jidea-116 make default country Thailand and rename child age groups (#26
Browse files Browse the repository at this point in the history
)

* make default country Thailand and rename child age groups

* fix test

* Dehyphenise preschool in label
  • Loading branch information
EmmaLRussell authored Oct 16, 2024
1 parent 91eee46 commit 0e437f5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions R/util.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ get_nested_costs <- function(raw_costs) {
cost_item("education_absences", education_absences)
)),
cost_item("life_years", life_years, list(
cost_item("life_years_infants", life_years_age[["0-4"]]),
cost_item("life_years_adolescents", life_years_age[["5-19"]]),
cost_item("life_years_pre_school", life_years_age[["0-4"]]),
cost_item("life_years_school_age", life_years_age[["5-19"]]),
cost_item("life_years_working_age", life_years_age[["20-65"]]),
cost_item("life_years_retirement_age", life_years_age[["65+"]])
))
Expand Down
6 changes: 3 additions & 3 deletions inst/json/metadata_0.1.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"label": "Country",
"description": "Select a country to set model parameters for country-specific demographic, patterns of social mixing and economic data",
"parameterType": "globeSelect",
"defaultOption": "United Kingdom",
"defaultOption": "Thailand",
"ordered": false,
"options": null
},
Expand Down Expand Up @@ -81,8 +81,8 @@
{ "id": "education_closures", "label": "Closures" },
{ "id": "education_absences", "label": "Absences" },
{ "id": "life_years", "label": "Life years" },
{ "id": "life_years_infants", "label": "Infants" },
{ "id": "life_years_adolescents", "label": "Adolescents" },
{ "id": "life_years_pre_school", "label": "Preschool-age children"},
{ "id": "life_years_school_age", "label": "School-age children" },
{ "id": "life_years_working_age", "label": "Working-age adults" },
{ "id": "life_years_retirement_age", "label": "Retirement-age adults" }
],
Expand Down
18 changes: 9 additions & 9 deletions tests/testthat/helper-daedalus-api.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ expect_nested_mock_costs <- function(costs) {
expect_identical(life_years$value, 50)
expect_length(life_years$children, 4L)

life_years_infants <- life_years$children[[1]]
expect_identical(life_years_infants$id, "life_years_infants")
expect_identical(life_years_infants$value, 5)
expect_false("children" %in% names(life_years_infants))

life_years_adolescents <- life_years$children[[2]]
expect_identical(life_years_adolescents$id, "life_years_adolescents")
expect_identical(life_years_adolescents$value, 10)
expect_false("children" %in% names(life_years_adolescents))
life_years_pre_school <- life_years$children[[1]]
expect_identical(life_years_pre_school$id, "life_years_pre_school")
expect_identical(life_years_pre_school$value, 5)
expect_false("children" %in% names(life_years_pre_school))

life_years_school_age <- life_years$children[[2]]
expect_identical(life_years_school_age$id, "life_years_school_age")
expect_identical(life_years_school_age$value, 10)
expect_false("children" %in% names(life_years_school_age))

life_years_working_age <- life_years$children[[3]]
expect_identical(life_years_working_age$id, "life_years_working_age")
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-endpoints.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ test_that("Can get metadata", {
}, character(1)),
daedalus_countries
)
expect_identical(params[[country_idx]]$defaultOption, "United Kingdom")
expect_identical(params[[country_idx]]$defaultOption, "Thailand")
hosp_cap_idx <- match("hospital_capacity", expected_parameters)
update_values <- res$data$parameters[[hosp_cap_idx]]$updateNumericFrom$values
expect_named(update_values, daedalus_countries)
Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/test-zzz-e2e.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,17 @@ test_that("can run model, get status and results", {
sum(education_closures$value,
education_absences$value),
tolerance = tolerance)
lifeyears_infants <- life_years_total$children[[1]]
expect_identical(lifeyears_infants$id, "life_years_infants")
lifeyears_adolescents <- life_years_total$children[[2]]
expect_identical(lifeyears_adolescents$id, "life_years_adolescents")
lifeyears_pre_school <- life_years_total$children[[1]]
expect_identical(lifeyears_pre_school$id, "life_years_pre_school")
lifeyears_school_age <- life_years_total$children[[2]]
expect_identical(lifeyears_school_age$id, "life_years_school_age")
lifeyears_working_age <- life_years_total$children[[3]]
expect_identical(lifeyears_working_age$id, "life_years_working_age")
lifeyears_retirement_age <- life_years_total$children[[4]]
expect_identical(lifeyears_retirement_age$id, "life_years_retirement_age")
expect_equal(life_years_total$value,
sum(lifeyears_infants$value,
lifeyears_adolescents$value,
sum(lifeyears_pre_school$value,
lifeyears_school_age$value,
lifeyears_working_age$value,
lifeyears_retirement_age$value),
tolerance = tolerance)
Expand Down

0 comments on commit 0e437f5

Please sign in to comment.