-
Notifications
You must be signed in to change notification settings - Fork 9
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
Improve population error #453
base: master
Are you sure you want to change the base?
Changes from 5 commits
084ae69
d04059c
c1ce23a
879bbaa
cd1b566
d11c86e
b17b74d
82fbc90
e1df8fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ test_that("artnum_mf() returns expected number of records", { | |
|
||
test_that("artnum_mf() throws errors for invalid inputs", { | ||
expect_error(artnum_mf("CY1924Q4", demo_art_number, a_naomi_mf), | ||
"No ART data found for quarter CY1924Q4.\nSet 'Include ART data' to 'No' if you intend to include no ART data.") | ||
"No ART data found for quarter CY1924Q4.\nIf you do not intend to include ART data set 'Include ART data' to 'No'.") | ||
expect_error(artnum_mf("CY2016Q1", demo_art_number, "jibberish")) | ||
expect_error(artnum_mf(c("CY2016Q1", "CY2016Q2"), demo_art_number, "jibberish")) | ||
}) | ||
|
@@ -53,7 +53,26 @@ test_that("artnum_mf() works with single quarter ART data", { | |
}) | ||
|
||
|
||
test_that("Informative error displayed when model run to admin level higher/lower than population data supplied", { | ||
x <- expect_error( | ||
naomi_model_frame(a_area_merged, | ||
demo_population_agesex, | ||
a_spec, | ||
scope = "MWI", | ||
level = 3, | ||
calendar_quarter1 = "CY2016Q1", | ||
calendar_quarter2 = "CY2018Q4", | ||
calendar_quarter3 = "CY2019Q2", | ||
calendar_quarter4 = "CY2022Q3", | ||
calendar_quarter5 = "CY2023Q3")) | ||
|
||
expect_equal( | ||
x$message, | ||
paste("Population data not available for admin level selected", | ||
"for model projections. Please review model options", | ||
"selection to ensure that area level selection is correct.") | ||
) | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could the error message here quote the area level and area level label selected?
Also I'm think I would remove the "for model projections". We usually use "projections" to refer to the T3/T4/T5 projection, but here this area level selection pertains to everything. |
||
|
||
test_that("population calibration options", { | ||
|
||
|
@@ -85,7 +104,7 @@ test_that("population calibration options", { | |
mf_none$mf_model$population_t2 + | ||
mf_none$mf_model$population_t3 + | ||
mf_none$mf_model$population_t4 + | ||
mf_none$mf_model$population_t5 | ||
mf_none$mf_model$population_t5 | ||
), | ||
sum(mf_none$spectrum_calibration$population_raw)) | ||
|
||
|
@@ -102,7 +121,7 @@ test_that("population calibration options", { | |
calendar_quarter2 = "CY2018Q4", | ||
calendar_quarter3 = "CY2019Q2", | ||
calendar_quarter4 = "CY2022Q3", | ||
calendar_quarter5 = "CY2023Q3", | ||
calendar_quarter5 = "CY2023Q3", | ||
spectrum_population_calibration = "national") | ||
|
||
expect_false(sum(mf_nat$spectrum_calibration$population_raw) == | ||
|
@@ -132,7 +151,7 @@ test_that("population calibration options", { | |
calendar_quarter2 = "CY2018Q4", | ||
calendar_quarter3 = "CY2019Q2", | ||
calendar_quarter4 = "CY2022Q3", | ||
calendar_quarter5 = "CY2023Q3", | ||
calendar_quarter5 = "CY2023Q3", | ||
spectrum_population_calibration = "subnational") | ||
|
||
expect_false(sum(mf_subnat$spectrum_calibration$population_raw) == | ||
|
@@ -162,7 +181,7 @@ test_that("population calibration options", { | |
calendar_quarter2 = "CY2018Q4", | ||
calendar_quarter3 = "CY2019Q2", | ||
calendar_quarter4 = "CY2022Q3", | ||
calendar_quarter5 = "CY2023Q3", | ||
calendar_quarter5 = "CY2023Q3", | ||
spectrum_population_calibration = "jibberish"), | ||
"spectrum_calibration_option \"jibberish\" not found." | ||
) | ||
|
@@ -319,7 +338,7 @@ test_that("naomi_model_frame() interpolated population depends on quarter specif | |
calendar_quarter2 = "CY2018Q4", | ||
calendar_quarter3 = "CY2019Q2", | ||
calendar_quarter4 = "CY2022Q3", | ||
calendar_quarter5 = "CY2023Q3", | ||
calendar_quarter5 = "CY2023Q3", | ||
spectrum_population_calibration = "subnational") | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the error message is about the area level selected, why is the conditional here referring to the area IDs (not the area level)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't area level available in the population data to easier to check that these intersect and then pull that in if they don't for the error message if needed