diff --git a/data/2024/2024-09-10/meta.yaml b/data/2024/2024-09-10/meta.yaml index 499bbdf30..1ef5e144e 100644 --- a/data/2024/2024-09-10/meta.yaml +++ b/data/2024/2024-09-10/meta.yaml @@ -1,12 +1,12 @@ -title: Economic Diversity and Student Outcomes +title: "Economic Diversity and Student Outcomes" article: - title: Economic diversity and student outcomes at the University of Texas at Dallas - url: https://www.nytimes.com/interactive/projects/college-mobility/university-of-texas-at-dallas + title: "Economic diversity and student outcomes at the University of Texas at Dallas" + url: "https://www.nytimes.com/interactive/projects/college-mobility/university-of-texas-at-dallas" data_source: title: "Opportunity Insights: College-Level Data for 139 Selective American Colleges" - url: https://opportunityinsights.org/data/ + url: "https://opportunityinsights.org/data/" images: -- file: utd-access.png +- file: "utd-access.png" alt: > Parent income for students attending The University of Texas at Dallas (UTD). The median family income is $89,800, which is among the highest in Texas but diff --git a/static/templates/assign_week.R b/static/templates/assign_week.R index 9e2eee6d2..938011cf7 100644 --- a/static/templates/assign_week.R +++ b/static/templates/assign_week.R @@ -4,7 +4,7 @@ # Set these variables ---------------------------------------------------------- # src_folder_name <- "american_idol" -# target_date <- "2024-07-23" +# target_date <- "2024-09-10" # Run these scripts ------------------------------------------------------------ @@ -18,7 +18,9 @@ fs::dir_create(target_dir) ## metadata -------------------------------------------------------------------- -metadata <- yaml::read_yaml(fs::path(src_dir, "meta.yaml")) +source(here::here("static", "templates", "metadata.R"), local = TRUE) + +metadata <- read_metadata(fs::path(src_dir, "meta.yaml")) dataset_files <- fs::dir_ls(src_dir, glob = "*.csv") |> unname() dataset_filenames <- basename(dataset_files) diff --git a/static/templates/metadata.R b/static/templates/metadata.R new file mode 100644 index 000000000..467f6c11b --- /dev/null +++ b/static/templates/metadata.R @@ -0,0 +1,18 @@ +read_metadata <- function(path) { + yaml_preprocess(path) + yaml::read_yaml +} + +yaml_preprocess <- function(path) { + readLines(path, warn = FALSE) |> + yaml_quote() |> + writeLines(path) +} + +yaml_quote <- function(yaml_lines) { + stringr::str_replace( + yaml_lines, + "^([^:]*:\\s+)([^>|\"'].*)$", + '\\1"\\2"' + ) +}