Skip to content

Commit

Permalink
adding in unknown priors and a total
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-bennettWk committed Jan 16, 2025
1 parent 4fc51a0 commit 0b3fd97
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 6 deletions.
13 changes: 12 additions & 1 deletion background_scripts/data_processing_func.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ TM_data_prod_func <- function(sql_data, ReportYear) {
mutate(SUBJ = sample(100:900, 1))

tm_data <- sql_data %>%
mutate(PRIOR_BAND = replace_na(PRIOR_BAND, "Unknown prior")) %>%
filter(
!(is.na(PRIOR_BAND)),
# !(is.na(PRIOR_BAND)),
!(is.na(SUBJ))
) # %>%
# bind_rows(tm_data_subj_na)
Expand All @@ -33,6 +34,15 @@ TM_data_prod_func <- function(sql_data, ReportYear) {
# ---- NUMBERS & PERCENTAGES CALCULATED ----
# -----------------------------------------------------------------------------------------------------------------------------

totals <- tm_data %>%
group_by(Qual_Description, SUBLEVNO, Potential_Level, ASIZE, GSIZE, MAPPING, Subject, gradeStructure, SUBJ, GRADE) %>%
summarise(total_students = sum(total_students, na.rm = TRUE)) %>%
ungroup() %>%
mutate(PRIOR_BAND = "zAll")

tm_data <- tm_data %>%
bind_rows(totals)

student_numbers <- tm_data %>%
mutate(
GRADE = case_when(
Expand All @@ -46,6 +56,7 @@ TM_data_prod_func <- function(sql_data, ReportYear) {
QUAL_ID = paste0(SUBLEVNO, SUBJ, SIZE, gradeStructure),
ROW_ID = paste0(SUBLEVNO, SUBJ, SIZE, PRIOR_BAND, gradeStructure)
) %>%
mutate(PRIOR_BAND = if_else(PRIOR_BAND == "zAll", "All", PRIOR_BAND)) %>%
mutate(across(c(everything(), -total_students), ~ as.character(.))) %>%
arrange(ROW_ID, .locale = "en") %>%
pivot_wider(names_from = GRADE, values_from = total_students)
Expand Down
Binary file modified data/all_student_numbers.rds
Binary file not shown.
Binary file modified data/all_student_percentages.rds
Binary file not shown.
Binary file modified data/qual_lookup.rds
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"input": {
"ReportYr_select": "2023",
"ReportYr_select": "2024",
"cookies": [
"GA1.1.1784488804.1728980230",
"GS1.1.1729152208.1.1.1729152369.0.0.0"
Expand Down Expand Up @@ -98,12 +98,12 @@
"TRUE"
],
"format": "Numbers data",
"grade_structure_select": "*,A,B,C,D,E",
"grade_structure_select": "D,M",
"link_to_app_content_tab": 0,
"navlistPanel": "Homepage",
"qual_select": "GCE A level",
"size_select": "1",
"subj_select": "Accounting / Finance"
"qual_select": "Advanced Extension Award",
"size_select": "0",
"subj_select": "Mathematics"
},
"output": {
"example_table": {
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0b3fd97

Please sign in to comment.