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

Add numberstring as an acceptable indicator_unit #134

Merged
merged 4 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion R/knownVariables.r
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ expected_eda_combinations <- unique(paste(edas$english_devolved_area_code, edas$
potential_ob_units_regex <- "(^(sch|prov|inst|estab|reg|la|local|rsc|pcon|lep|mca|oa|ward|mat).*(name|code|urn|ukprn|number|upin|id)$)|(^(laestab|estab|sch|school|schools|prov|provider|providers|inst|institution|institutions|name|code|urn|ukprn|number|upin|id|region|la|lad|rsc|pcon|lep|mca|oa|ward|mat)$)"

# Indicator units =====================================================================================================
acceptable_indicatorunits <- c("%", "pp", "£", "£m")
acceptable_indicatorunits <- c("%", "pp", "£", "£m", "numberstring")

# Harmonised values ===================================================================================================
ethnicity_standard_values <- suppressMessages(read_csv("data/ethnicity.csv"))
16 changes: 11 additions & 5 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3903,7 +3903,7 @@
"checksum": "e5b9343c9a0e43d83e02b339946591d1"
},
".Rprofile": {
"checksum": "48d983e0bfe75553a940019bee72a138"
"checksum": "f187865370477bda269a0c2c42ba77b4"
},
"azure-pipelines-dev.yml": {
"checksum": "fc2ef843ff5024bcba25ff84eec05f4c"
Expand Down Expand Up @@ -3981,7 +3981,7 @@
"checksum": "1c3a5b538aa71e2f377b4733e7c9a580"
},
"R/knownVariables.r": {
"checksum": "7248277e0e99b5aee4e66bf9e8c69963"
"checksum": "3c352f0113bdd8cf4262617436f09c6d"
},
"R/mainTests.r": {
"checksum": "58b52819cc963c2cdcbe70024a0307b7"
Expand Down Expand Up @@ -4341,10 +4341,10 @@
"checksum": "ed9d3ebd24026a2e795894679395dc10"
},
"tests/testthat/mainTests/indicator_unit_validation.csv": {
"checksum": "34b34be457d8e3d94c95857cc52d719c"
"checksum": "840270c5e0a6fe330046ad63fa3db265"
},
"tests/testthat/mainTests/indicator_unit_validation.meta.csv": {
"checksum": "4941902672323226dcadc1445db88891"
"checksum": "a6e4c62f6e986c7be03ce023471f4196"
},
"tests/testthat/mainTests/indicators_smushed.csv": {
"checksum": "ed524ab3c650cbb27cb31e2d4625b3d9"
Expand Down Expand Up @@ -4562,6 +4562,12 @@
"tests/testthat/otherData/financial_quarter.meta.csv": {
"checksum": "882f2fce79e2aad3555a576d3f665997"
},
"tests/testthat/otherData/indicator_units_should_pass.csv": {
"checksum": "48f2e6c646ff7288862e9cf86c91ec66"
},
"tests/testthat/otherData/indicator_units_should_pass.meta.csv": {
"checksum": "623560ff6bd6fb4cde9947dc43e1f808"
},
"tests/testthat/otherData/lad_within_la.csv": {
"checksum": "013596ebab17236f2efee8fe70f7c0b7"
},
Expand Down Expand Up @@ -4905,7 +4911,7 @@
"checksum": "41a423a4bc68e5ba6c20a11f06092471"
},
"tests/testthat/test-function-edge_cases.R": {
"checksum": "f28bebce557004db15917ee71e2a4fab"
"checksum": "967f63745faee40e71b3f5c74a2006e1"
},
"tests/testthat/test-function-fileValidation.R": {
"checksum": "302dd04b308471644c1a6574c3844c81"
Expand Down
380 changes: 4 additions & 376 deletions tests/testthat/mainTests/indicator_unit_validation.csv

Large diffs are not rendered by default.

10 changes: 2 additions & 8 deletions tests/testthat/mainTests/indicator_unit_validation.meta.csv
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
col_name,col_type,label,indicator_grouping,indicator_unit,indicator_dp,filter_hint,filter_grouping_column
num_schools,Indicator,Number of schools,Absence fields,,0,,
enrolments,Indicator,Number of pupil enrolments,Absence fields,,0,,
sess_overall_percent,Indicator,Overall absence rate,Absence fields,%,0,,
sess_authorised_percent,Indicator,Authorised absence rate,Absence fields,£m,1,,
sess_unauthorised_percent,Indicator,Unauthorised absence rate,Absence fields,%,2,,
enrolments_pa_10_exact,Indicator,Number of persistent absentees,Absence fields,$,0,,
enrolments_pa_10_exact_percent,Indicator,Percentage of persistent absentees,Absence fields,%,3,,
school_type,Filter,School type,,,,Filter by school type,school_phase
number_persistent_absentees,Indicator,Number of persistent absentees,Absence fields,$,0,,
perc_persistent_absentees,Indicator,Percentage of persistent absentees,Absence fields,%,3,,
4 changes: 4 additions & 0 deletions tests/testthat/otherData/indicator_units_should_pass.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
time_period,time_identifier,geographic_level,country_code,country_name,region_code,region_name,school_phase,school_type,num_schools,enrolments,sess_overall_percent,sess_authorised_percent,sess_unauthorised_percent,enrolments_pa_10_exact,enrolments_pa_10_exact_percent,example_id
201718,Academic year,Regional,E92000001,England,E12000001,North East,Combined,State-funded primary and secondary,1033,317616,4.62038,3.12503,1.49536,39300,12.37343,19950808
201718,Academic year,Regional,E92000001,England,E12000001,North East,Individual,State-funded primary,858,175079,3.90145,2.7663,1.13516,18073,10.32277,19950808
201718,Academic year,Regional,E92000001,England,E12000001,North East,Individual,State-funded secondary,175,142537,5.51279,3.57032,1.94247,21227,14.89227,19950808
10 changes: 10 additions & 0 deletions tests/testthat/otherData/indicator_units_should_pass.meta.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
col_name,col_type,label,indicator_grouping,indicator_unit,indicator_dp,filter_hint,filter_grouping_column
num_schools,Indicator,Number of schools,Absence fields,,0,,
enrolments,Indicator,Number of pupil enrolments,Absence fields,,0,,
sess_overall_percent,Indicator,Overall absence rate,Absence fields,%,0,,
sess_authorised_percent,Indicator,Authorised absence rate,Absence fields,£m,1,,
sess_unauthorised_percent,Indicator,Unauthorised absence rate,Absence fields,£,2,,
enrolments_pa_10_exact,Indicator,Number of persistent absentees,Absence fields,pp,0,,
enrolments_pa_10_exact_percent,Indicator,Percentage of persistent absentees,Absence fields,%,3,,
example_id,Indicator,Example ID,Other,numberstring,,,
school_type,Filter,School type,,,,Filter by school type,school_phase
6 changes: 6 additions & 0 deletions tests/testthat/test-function-edge_cases.R
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,9 @@ test_that("Can handle incorrect provider cols", {
test_that("Can handle missing region_name", {
expect_no_error(screeningOutput <- testOther("../../tests/testthat/otherData/missing_region_name.csv"))
})

test_that("all valid indicator units do pass", {
screeningOutput <- testOther("../../tests/testthat/otherData/indicator_units_should_pass.csv")

expect_equal(screeningOutput$results %>% filter(test == "indicator_unit_validation") %>% pull(result) %>% unlist(use.names = FALSE), "PASS")
})