Stub out AE7Q actions work.
This commit is contained in:
@ -165,7 +165,7 @@ ae7q_table_state <- ae7q_table_state_raw %>%
|
||||
General, Advanced, AmateurExtra, Total, ttp, conditional,
|
||||
Club)
|
||||
|
||||
###### AE7Q New Licenses ######
|
||||
###### AE7Q License Actions ######
|
||||
ae7q_new_url <- paste0("https://www.ae7q.com/query/list/ProcessDate.php?DATE=", Sys.Date())
|
||||
|
||||
# Read the page
|
||||
@ -178,15 +178,31 @@ if(!grepl("No license grants found issued on", ae7q_new_raw %>% html_text())){
|
||||
html_elements(xpath = "//table") %>%
|
||||
html_table()
|
||||
|
||||
ae7q_table_new <- ae7q_new_tables[[14]]
|
||||
# Find the right table by the column names
|
||||
right_table_id <- grep(c("Callsign",
|
||||
"Region/ State",
|
||||
"Entity Name",
|
||||
"Applicant Type",
|
||||
"Licensee Class",
|
||||
"License Status",
|
||||
"Action Type"),
|
||||
lapply(ae7q_new_tables, names))
|
||||
|
||||
ae7q_table_new <- ae7q_new_tables[[right_table_id]]
|
||||
|
||||
ae7q_sum01 <- ae7q_table_new %>% mutate(across(everything(), ~na_if(., "\""))) %>%
|
||||
fill(everything()) %>%
|
||||
group_by(`Applicant Type`,
|
||||
`Licensee Class`,
|
||||
`License Status`,
|
||||
`Action Type`) %>%
|
||||
summarize(count = n(), .groups = "keep")
|
||||
group_by(`Action Type`) %>%
|
||||
summarize(count = n(), .groups = "keep") %>%
|
||||
mutate(date = Sys.Date(),
|
||||
source = "AE7Q", source_detail = ae7q_new_url) %>%
|
||||
relocate(date)
|
||||
} else {
|
||||
ae7q_sum01 <- data.frame("date" = Sys.Date(),
|
||||
"Action Type" = NA,
|
||||
"count" = NA,
|
||||
"source" = "AE7Q",
|
||||
"source_detail" = ae7q_new_url)
|
||||
}
|
||||
|
||||
|
||||
@ -210,3 +226,8 @@ write.table(ae7q_table_state, file = "out/ae7q-states-scraped.csv", sep = ",",
|
||||
append = TRUE, quote = FALSE,
|
||||
col.names = F, row.names = FALSE,
|
||||
na = "")
|
||||
|
||||
write.table(ae7q_sum01, file = "out/ae7q-actions-scraped.csv", sep = ",",
|
||||
append = TRUE, quote = FALSE,
|
||||
col.names = F, row.names = FALSE,
|
||||
na = "")
|
||||
|
Reference in New Issue
Block a user