Snapshot while working on scraping.

This commit is contained in:
mattbk 2024-09-21 13:19:31 -05:00
parent 9f46e49b10
commit beeb68040f

View File

@ -128,7 +128,7 @@ hamcall_table_state <- left_join(hamcall_table_state, state_codes, by = join_by(
relocate(source_name:source_detail, .after = m)
###### AE7Q ######
###### AE7Q States ######
ae7q_url <- "https://www.ae7q.com/query/stat/LicenseUSA.php"
# Read the page
@ -165,6 +165,31 @@ ae7q_table_state <- ae7q_table_state_raw %>%
General, Advanced, AmateurExtra, Total, ttp, conditional,
Club)
###### AE7Q New Licenses ######
ae7q_new_url <- paste0("https://www.ae7q.com/query/list/ProcessDate.php?DATE=", Sys.Date())
# Read the page
ae7q_new_raw <- read_html(ae7q_new_url)
# Make sure the new license table exists first
if(!grepl("No license grants found issued on", ae7q_new_raw %>% html_text())){
# Get tables and clean up
ae7q_new_tables <- ae7q_new_raw %>%
html_elements(xpath = "//table") %>%
html_table()
ae7q_table_new <- ae7q_new_tables[[14]]
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")
}
##### Append tables #####
write.table(hamcall_table_class_pivot, file = "out/hamcall-licenses-scraped.csv", sep = ",",
append = TRUE, quote = FALSE,