election_dates <- function() { tibble::tribble( ~ date, ~ description, ~ source, "03/05/2024", "2024 Primary", "https://www.ncsbe.gov/campaign-finance/reporting-schedules", "11/05/2024", "2024 General", "https://www.ncsbe.gov/campaign-finance/reporting-schedules", "05/17/2022", "2022 Primary", "https://web.archive.org/web/20221110183405/https://www.ncsbe.gov/campaign-finance/reporting-schedules", "11/08/2022", "2022 General", "https://web.archive.org/web/20221110183405/https://www.ncsbe.gov/campaign-finance/reporting-schedules", "3/03/2020", "2020 Primary", "https://web.archive.org/web/20200126233324/https://www.ncsbe.gov/index.html", "11/03/2020", "2020 General", "https://en.wikipedia.org/wiki/2020_United_States_presidential_election_in_North_Carolina", "05/08/2018", "2018 Primary", "https://web.archive.org/web/20181223144944/https://www.ncsbe.gov/Elections", "11/06/2018", "2018 General", "https://web.archive.org/web/20181223144944/https://www.ncsbe.gov/Elections", "03/15/2016", "2016 Primary", "https://web.archive.org/web/20160131011839/http://www.ncsbe.gov/Elections/Election-Information", "11/08/2016" ,"2016 General", "https://web.archive.org/web/20160131011839/http://www.ncsbe.gov/Elections/Election-Information" ) |> mutate(date = mdy(date)) } reporting_schedule <- function() { list( "2023" = # https://www.ncsbe.gov/campaign-finance/reporting-schedules tibble::tribble( ~Report.Year, ~Report.Name, ~Report.Start.Date, ~Report.End.Date, ~Report.Due.Date, 2023L, "Mid-Year Semi-Annual", "01/01/2023", "06/30/2023", "07/28/2023", 2023L, "Year-End Semi-Annual", "07/01/2023", "12/31/2023", "01/26/2024", 2024L, "First Quarter Plus", "01/01/2024", "02/17/2024", "02/27/2024", 2024L, "Second Quarter", "02/18/2024", "06/30/2024", "07/10/2024", 2024L, "Third Quarter Plus", "07/01/2024", "10/19/2024", "10/29/2024", 2024L, "Fourth Quarter", "10/20/2024", "12/31/2024", "01/10/2025", 2024L, "Mid-year Semi-Annual*", "01/01/2024", "06/30/2024", "07/26/2024", 2024L, "Year-End Semi-Annual*", "07/01/2024", "12/31/2024", "01/31/2025" ), "2021" = # https://web.archive.org/web/20210823183129/https://www.ncsbe.gov/campaign-finance/reporting-schedules tibble::tribble( ~Report.Year, ~Report.Name, ~Report.Start.Date, ~Report.End.Date, ~Report.Due.Date, 2021L, "Mid-Year Semiannual", "01/01/2021", "06/30/2021", "07/30/2021", 2021L, "Year-End Semiannual", "07/01/2021", "12/31/2021", "01/28/2022" ), "2022" = # https://web.archive.org/web/20221110183405/https://www.ncsbe.gov/campaign-finance/reporting-schedules tibble::tribble( ~Report.Year, ~Report.Name, ~Report.Start.Date, ~Report.End.Date, ~Report.Due.Date, 2022L, "First Quarter Plus", "01/01/2022", "04/30/2022", "05/10/2022", 2022L, "Second Quarter", "05/01/2022", "06/30/2022", "07/12/2022", 2022L, "Third Quarter Plus", "07/01/2022", "10/22/2022", "11/01/2022", 2022L, "Fourth Quarter", "10/23/2022", "12/31/2022", "01/11/2023", 2022L, "Mid-Year Semiannual*", "01/01/2022", "06/30/2022", "07/29/2022", 2022L, "Year-End Semiannual*", "07/01/2022", "12/31/2022", "01/27/2023" ), "2020" = # https://web.archive.org/web/20201228050159/https://www.ncsbe.gov/campaign-finance/reporting-schedules tibble::tribble( ~Report.Year, ~Report.Name, ~Report.Start.Date, ~Report.End.Date, ~Report.Due.Date, 2019L, "Mid-Year Semiannual", "1/1/2019", "6/30/2019", "7/26/2019", 2019L, "Year-End Semiannual", "7/1/2019", "12/31/2019", "1/31/2020", 2020L, "First Quarter Plus", "1/1/2020", "2/15/2020", "2/25/2020", 2020L, "Second Quarter", "2/16/2020", "6/30/2020", "7/10/2020", 2020L, "Third Quarter Plus", "7/1/2020", "10/17/2020", "10/27/2020", 2020L, "Fourth Quarter", "10/18/2020", "12/31/2020", "1/12/2021", 2020L, "Mid-Year Semi-Annual*", "1/1/2020", "6/30/2020", "7/31/2020", 2020L, "Year-End Semi-Annual*", "7/1/2020", "12/31/2020", "1/29/2021" ), "2018" = # https://web.archive.org/web/20181223145312/https://www.ncsbe.gov/campaign-finance/reporting-schedules tibble::tribble( ~Report.Year, ~Report.Name, ~Report.Start.Date, ~Report.End.Date, ~Report.Due.Date, 2018L, "First Quarter Plus", "1/1/2018", "4/21/2018", "4/30/2018", 2018L, "Second Quarter", "4/22/2018", "6/30/2018", "7/11/2018", 2018L, "Mid Year Semi Annual*", "1/1/2018", "6/30/2018", "7/27/2018", 2018L, "Third Quarter Plus", "7/1/2018", "10/20/2018", "10/29/2018", 2018L, "Fourth Quarter", "10/21/2018", "12/31/2018", "1/10/2019", 2018L, "Year End Semi Annual*", "7/1/2018", "12/31/2018", "1/25/2019", 2019L, "Mid Year Semi Annual", "1/1/2019", "6/30/2019", "7/26/2019", 2019L, "Year End Semi Annual", "7/1/2019", "12/31/2019", "1/31/2020" ), "2017" = # https://web.archive.org/web/20170219143056/https://www.ncsbe.gov/campaign-finance/reporting-schedules tibble::tribble( ~Report.Year, ~Report.Name, ~Report.Start.Date, ~Report.End.Date, ~Report.Due.Date, 2017L, "Mid Year Semi Annual", "1/1/2017", "6/30/2017", "7/28/2017", 2017L, "Year End Semi Annual", "7/1/2017", "12/31/2017", "1/26/2018", ), "2016" = # https://web.archive.org/web/20160201011756/https://www.ncsbe.gov/campaign-finance/reporting-schedules tibble::tribble( ~Report.Year, ~Report.Name, ~Report.Start.Date, ~Report.End.Date, ~Report.Due.Date, 2015L, "Year End Semi Annual", "7/1/2015", "12/31/2015", "1/29/2016", 2016L, "First Quarter", "1/1/2016", "2/29/2016", "3/7/2016", 2016L, "Second Quarter", "3/1/2016", "6/30/2016", "7/12/2016", 2016L, "Mid Year Semi Annual*", "1/1/2016", "6/30/2016", "7/29/2016", 2016L, "Third Quarter", "7/1/2016", "10/22/2016", "10/31/2016", 2016L, "Fourth Quarter", "10/23/2016", "12/31/2016", "1/11/2017", 2016L, "Year End Semi Annual*", "7/1/2016", "12/31/2016", "1/27/2017" ) ) |> list_rbind() |> set_names(c("year", "doc_name", "sboe_start_date", "sboe_end_date", "sboe_due_date")) |> type_convert( col_types = cols( doc_name = col_character(), sboe_start_date = col_date(format = "%m/%d/%Y"), sboe_end_date = col_date(format = "%m/%d/%Y"), sboe_due_date = col_date(format = "%m/%d/%Y") ) ) |> mutate( sboe_alt = stringr::str_detect(doc_name, "[*]$"), doc_name = doc_name |> stringr::str_replace("Mid-[Yy]ear", "Mid Year") |> stringr::str_replace("Year-End", "Year End") |> stringr::str_replace("[Ss]emi ?[Aa]nnual", "Semi-Annual") |> stringr::str_remove(" Plus") |> stringr::str_remove("[*]") ) |> distinct() }