Skip to content

Commit

Permalink
Merge pull request #9 from dfe-analytical-services/outcome1/childwell…
Browse files Browse the repository at this point in the history
…being&development

Outcome1/childwellbeing&development
  • Loading branch information
yauemily authored Mar 21, 2024
2 parents dec483e + 1202904 commit f4660aa
Show file tree
Hide file tree
Showing 10 changed files with 22,282 additions and 217 deletions.
8 changes: 4 additions & 4 deletions R/enabler2_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ enabler2_tab <- function() {
),
gov_row(
h2("Turnover rates by region"),
p("This is a static chart and will not react to geographical level and breakdown selected in the filters at the top."),
p("This is a static chart and will not react to geographical level and location selected in the filters at the top."),
br(),
plotlyOutput("plot_turnover_reg"),
br(),
Expand Down Expand Up @@ -238,7 +238,7 @@ enabler2_tab <- function() {
),
gov_row(
h2("Agency rates by region"),
p("This is a static chart and will not react to geographical level and breakdown selected in the filters at the top."),
p("This is a static chart and will not react to geographical level and location selected in the filters at the top."),
br(),
plotlyOutput("plot_agency_reg"),
br(),
Expand Down Expand Up @@ -310,7 +310,7 @@ enabler2_tab <- function() {
),
gov_row(
h2("Vacancy rates by region"),
p("This is a static chart and will not react to geographical level and breakdown selected in the filters at the top."),
p("This is a static chart and will not react to geographical level and location selected in the filters at the top."),
br(),
plotlyOutput("plot_vacancy_reg"),
br(),
Expand Down Expand Up @@ -398,7 +398,7 @@ enabler2_tab <- function() {
),
gov_row(
h2("Social worker caseloads by region"),
p("This is a static chart and will not react to geographical level and breakdown selected in the filters at the top."),
p("This is a static chart and will not react to geographical level and location selected in the filters at the top."),
br(),
plotlyOutput("plot_caseload_reg"),
br(),
Expand Down
419 changes: 396 additions & 23 deletions R/outcome1_page.R

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions R/outcome2_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ outcome2_tab <- function() {
),
gov_row(
h2("Special Guardianship Order (SGO) by region"),
p("This is a static chart and will not react to geographical level and breakdown selected in the filters at the top.
p("This is a static chart and will not react to geographical level and location selected in the filters at the top.
The graph represents data from 2023."),
br(),
Expand Down Expand Up @@ -211,7 +211,7 @@ The graph represents data from 2023."),
),
gov_row(
h2("Residence order or Child Arrangement Order (CAO) by region"),
p("This is a static chart and will not react to geographical level and breakdown selected in the filters at the top.
p("This is a static chart and will not react to geographical level and location selected in the filters at the top.
The graph represents data from 2023."),
br(),
Expand Down
124 changes: 124 additions & 0 deletions R/read_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -681,3 +681,127 @@ read_outcome2 <- function(file = "data/la_children_who_ceased_during_the_year.cs
))
return(joined)
}


# Outcome 1 Outcomes absence data for child well being and development
read_outcomes_absence_data <- function(file = "data/absence_six_half_terms_la.csv") {
outcomes_absence_data <- read.csv(file)
# Select only columns we want
outcomes_absence_data <- outcomes_absence_data %>%
mutate(geo_breakdown = case_when(
geographic_level == "National" ~ "National", # NA_character_,
geographic_level == "Regional" ~ region_name,
geographic_level == "Local authority" ~ la_name
)) %>%
select(
geographic_level, geo_breakdown, country_code, region_code, new_la_code, time_period,
"time_period", "geographic_level", "region_name", year_breakdown, social_care_group,
school_type, t_pupils, t_sess_possible, t_sess_overall, pt_overall, t_sess_authorised,
pt_sess_authorised, t_sess_unauthorised, pt_sess_unauthorised, t_pupils_pa_10_exact, pt_pupils_pa_10_exact
)

# Make % columns numeric
outcomes_absence_data <- outcomes_absence_data %>%
mutate(`Overall absence (%)` = case_when(
pt_overall == "z" ~ NA,
pt_overall == "c" ~ NA,
pt_overall == "k" ~ NA,
pt_overall == "x" ~ NA,
TRUE ~ as.numeric(pt_overall)
)) %>%
mutate(`Persistent absentees (%)` = case_when(
pt_pupils_pa_10_exact == "z" ~ NA,
pt_pupils_pa_10_exact == "c" ~ NA,
pt_pupils_pa_10_exact == "k" ~ NA,
pt_pupils_pa_10_exact == "x" ~ NA,
TRUE ~ as.numeric(pt_pupils_pa_10_exact)
)) %>%
mutate(`Authorised absence (%)` = case_when(
pt_sess_authorised == "z" ~ NA,
pt_sess_authorised == "c" ~ NA,
pt_sess_authorised == "k" ~ NA,
pt_sess_authorised == "x" ~ NA,
TRUE ~ as.numeric(pt_sess_authorised)
)) %>%
mutate(`Unauthorised absence (%)` = case_when(
pt_sess_unauthorised == "z" ~ NA,
pt_sess_unauthorised == "c" ~ NA,
pt_sess_unauthorised == "k" ~ NA,
pt_sess_unauthorised == "x" ~ NA,
TRUE ~ as.numeric(pt_sess_unauthorised)
))


return(outcomes_absence_data)
}


# Outcome 1 Outcomes KS2 data for education attainment
read_outcomes_ks2_data <- function(file = "data/ks2_la.csv") {
outcomes_ks2_data <- read.csv(file)
# Select only columns we want
outcomes_ks2_data <- outcomes_ks2_data %>%
mutate(geo_breakdown = case_when(
geographic_level == "National" ~ "National", # NA_character_,
geographic_level == "Regional" ~ region_name,
geographic_level == "Local authority" ~ la_name
)) %>%
select(
geographic_level, geo_breakdown, country_code, region_code, new_la_code, time_period,
"time_period", "geographic_level", "region_name", social_care_group,
version, t_read_eligible_pupils, t_read_met_expected_standard, pt_read_met_expected_standard, t_writta_eligible_pupils,
t_writta_met_expected_standard, pt_writta_met_expected_standard, t_mat_eligible_pupils, t_mat_met_expected_standard,
pt_mat_met_expected_standard, t_rwm_eligible_pupils, t_rwm_met_expected_standard, pt_rwm_met_expected_standard,
t_gps_eligible_pupils, t_gps_met_expected_standard, pt_gps_met_expected_standard, t_scita_eligible_pupils,
t_scita_met_expected_standard, pt_scita_met_expected_standard, t_read_progress_eligible_pupils,
t_read_progress_score, avg_read_progress_score, avg_read_progress_score_lower_CI, avg_read_progress_score_upper_CI,
t_writta_progress_eligible_pupils, t_writta_progress_score, avg_writta_progress_score, avg_writta_progress_score_lower_CI,
avg_writta_progress_score_upper_CI, t_mat_progress_eligible_pupils, t_mat_progress_score, avg_mat_progress_score,
avg_mat_progress_score_lower_CI, avg_mat_progress_score_upper_CI
)

# Make % columns numeric
outcomes_ks2_data <- outcomes_ks2_data %>%
mutate(`Expected standard reading writing maths (%)` = case_when(
pt_rwm_met_expected_standard == "z" ~ NA,
pt_rwm_met_expected_standard == "c" ~ NA,
pt_rwm_met_expected_standard == "k" ~ NA,
pt_rwm_met_expected_standard == "x" ~ NA,
TRUE ~ as.numeric(pt_rwm_met_expected_standard)
))


return(outcomes_ks2_data)
}

# Outcome 1 Outcomes KS4 data for education attainment
read_outcomes_ks4_data <- function(file = "data/ks4_la.csv") {
outcomes_ks4_data <- read.csv(file)
# Select only columns we want
outcomes_ks4_data <- outcomes_ks4_data %>%
mutate(geo_breakdown = case_when(
geographic_level == "National" ~ "National", # NA_character_,
geographic_level == "Regional" ~ region_name,
geographic_level == "Local authority" ~ la_name
)) %>%
select(
geographic_level, geo_breakdown, country_code, region_code, new_la_code, time_period,
"time_period", "geographic_level", "region_name", social_care_group,
version, t_pupils, t_att8, avg_att8, t_l2basics_95, pt_l2basics_95, t_l2basics_94, pt_l2basics_94,
t_ebacc_e_ptq_ee, pt_ebacc_e_ptq_ee, t_ebaccaps, avg_ebaccaps, t_inp8calc,
t_p8score, avg_p8score, p8score_CI_low, p8score_CI_upp
)

# Make number columns numeric
outcomes_ks4_data <- outcomes_ks4_data %>%
mutate(`Average Attainment 8` = case_when(
avg_att8 == "z" ~ NA,
avg_att8 == "c" ~ NA,
avg_att8 == "k" ~ NA,
avg_att8 == "x" ~ NA,
TRUE ~ as.numeric(avg_att8)
))


return(outcomes_ks4_data)
}
Loading

0 comments on commit f4660aa

Please sign in to comment.